From 3d7f65f52b1a4b38f7ca561d460a78125dd31df1 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Thu, 23 Nov 2017 01:26:53 +0100 Subject: relax open type field type check on assignment (#105) --- pyasn1/codec/ber/decoder.py | 12 ++---------- pyasn1/type/univ.py | 3 ++- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'pyasn1') diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py index 2607d51..9c9195c 100644 --- a/pyasn1/codec/ber/decoder.py +++ b/pyasn1/codec/ber/decoder.py @@ -583,11 +583,7 @@ class UniversalConstructedTypeDecoder(AbstractConstructedDecoder): asn1Spec=openType ) - asn1Object.setComponentByPosition( - idx, component, - matchTags=False, - matchConstraints=False - ) + asn1Object.setComponentByPosition(idx, component) else: asn1Object.verifySizeSpec() @@ -723,11 +719,7 @@ class UniversalConstructedTypeDecoder(AbstractConstructedDecoder): ) if component is not eoo.endOfOctets: - asn1Object.setComponentByPosition( - idx, component, - matchTags=False, - matchConstraints=False - ) + asn1Object.setComponentByPosition(idx, component) else: asn1Object.verifySizeSpec() diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py index 6e5824c..ef63ba8 100644 --- a/pyasn1/type/univ.py +++ b/pyasn1/type/univ.py @@ -2352,7 +2352,8 @@ class SequenceAndSetBase(base.AbstractConstructedAsn1Item): subComponentType.isSuperTypeOf) if not subtypeChecker(value, matchTags, matchConstraints): - raise error.PyAsn1Error('Component value is tag-incompatible: %r vs %r' % (value, componentType)) + if not componentType[idx].openType: + raise error.PyAsn1Error('Component value is tag-incompatible: %r vs %r' % (value, componentType)) if verifyConstraints and value.isValue: try: -- cgit v1.2.3