X-Git-Url: http://www.git.cypherpunks.ru/?p=pyderasn.git;a=blobdiff_plain;f=pyderasn.py;h=38b05484720648f7d5242db4f7ade865a85cbd1a;hp=b9bc9dae515564a24dcc052005754d54993fca03;hb=a862bd86ae10ebed1bc42e172b89b74e091e20f5;hpb=a34b3e75db1e13750560c89c2b80821f2e5d0d1f diff --git a/pyderasn.py b/pyderasn.py index b9bc9da..38b0548 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -5025,16 +5025,24 @@ class SequenceOf(Obj): vlen += value_len v = v_tail _value.append(value) - obj = self.__class__( - value=_value, - schema=spec, - bounds=(self._bound_min, self._bound_max), - impl=self.tag, - expl=self._expl, - default=self.default, - optional=self.optional, - _decoded=(offset, llen, vlen + (EOC_LEN if lenindef else 0)), - ) + try: + obj = self.__class__( + value=_value, + schema=spec, + bounds=(self._bound_min, self._bound_max), + impl=self.tag, + expl=self._expl, + default=self.default, + optional=self.optional, + _decoded=(offset, llen, vlen + (EOC_LEN if lenindef else 0)), + ) + except BoundsError as err: + raise DecodeError( + msg=str(err), + klass=self.__class__, + decode_path=decode_path, + offset=offset, + ) if lenindef: if v[:EOC_LEN].tobytes() != EOC: raise DecodeError(