pyderasn.py | 10 ++++++++++ diff --git a/pyderasn.py b/pyderasn.py index d027931a1f148145015cf40fe1ed0f4f5c6bf829898180b6cecc2bfbdc0e9e30..10a56e7e6591696f7a9ae8d57b57f4b07c9b748c76a71126d3303a8b272ac816 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -1057,6 +1057,7 @@ eoc_expected, tail = tail[:EOC_LEN], tail[EOC_LEN:] if eoc_expected.tobytes() != EOC: raise DecodeError( "no EOC", + klass=self.__class__, decode_path=decode_path, offset=offset, ) @@ -2203,6 +2204,7 @@ if t == self.tag_constructed: if not ctx.get("bered", False): raise DecodeError( "unallowed BER constructed encoding", + klass=self.__class__, decode_path=decode_path, offset=offset, ) @@ -2248,6 +2250,7 @@ break if vlen > l: raise DecodeError( "chunk out of bounds", + klass=self.__class__, decode_path=len(chunks) - 1, offset=chunks[-1].offset, ) @@ -2263,6 +2266,7 @@ ) except TagMismatch: raise DecodeError( "expected BitString encoded chunk", + klass=self.__class__, decode_path=sub_decode_path, offset=sub_offset, ) @@ -2273,6 +2277,7 @@ v = v_tail if len(chunks) == 0: raise DecodeError( "no chunks", + klass=self.__class__, decode_path=decode_path, offset=offset, ) @@ -2282,6 +2287,7 @@ for chunk_i, chunk in enumerate(chunks[:-1]): if chunk.bit_len % 8 != 0: raise DecodeError( "BitString chunk is not multiple of 8 bit", + klass=self.__class__, decode_path=decode_path + (str(chunk_i),), offset=chunk.offset, ) @@ -2566,6 +2572,7 @@ if t == self.tag_constructed: if not ctx.get("bered", False): raise DecodeError( "unallowed BER constructed encoding", + klass=self.__class__, decode_path=decode_path, offset=offset, ) @@ -2611,6 +2618,7 @@ break if vlen > l: raise DecodeError( "chunk out of bounds", + klass=self.__class__, decode_path=len(chunks) - 1, offset=chunks[-1].offset, ) @@ -2626,6 +2634,7 @@ ) except TagMismatch: raise DecodeError( "expected OctetString encoded chunk", + klass=self.__class__, decode_path=sub_decode_path, offset=sub_offset, ) @@ -2636,6 +2645,7 @@ v = v_tail if len(chunks) == 0: raise DecodeError( "no chunks", + klass=self.__class__, decode_path=decode_path, offset=offset, )