From d83c99d986376e1a7d7a200132dd6fc6d12bdcd5 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Tue, 10 Oct 2017 13:22:50 +0200 Subject: do not attempt to decode optional open types --- pyasn1/codec/ber/decoder.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pyasn1/codec') diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py index b1863ab..f2c4e4a 100644 --- a/pyasn1/codec/ber/decoder.py +++ b/pyasn1/codec/ber/decoder.py @@ -561,6 +561,9 @@ class UniversalConstructedTypeDecoder(AbstractConstructedDecoder): if not namedType.openType: continue + if namedType.isOptional and not asn1Object.getComponentByPosition(idx).isValue: + continue + governingValue = asn1Object.getComponentByName( namedType.openType.name ) @@ -697,6 +700,9 @@ class UniversalConstructedTypeDecoder(AbstractConstructedDecoder): if not namedType.openType: continue + if namedType.isOptional and not asn1Object.getComponentByPosition(idx).isValue: + continue + governingValue = asn1Object.getComponentByName( namedType.openType.name ) -- cgit v1.2.3