summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-11-14 12:12:12 +0100
committerIlya Etingof <etingof@gmail.com>2017-11-14 12:12:12 +0100
commit9ec03d3837d3333f0edb2a0f9919dcf82c1f679c (patch)
treef48c891bf061d1107afaeb36b92b03b5a1182e73
parentb623b4603d149a4565c6d58e4e85fc31ff2bea2c (diff)
downloadpyasn1-git-9ec03d3837d3333f0edb2a0f9919dcf82c1f679c.tar.gz
fixed Sequence/SequenceOf decoding heuristics
-rw-r--r--CHANGES.rst6
-rw-r--r--pyasn1/codec/ber/decoder.py7
2 files changed, 7 insertions, 6 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index e1c9ad0..14337d5 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -17,13 +17,15 @@ Revision 0.4.1, released XX-10-2017
- Changed `Null` object initialization behaviour: previous default
value (`''`) is not set anymore. Thus `Null()` call produces a
ASN.1 schema object, while `Null('')` - value object.
-- Migrated all docs and references from SourceForge.
+- Migrated all docs and references from SourceForge
- Fixed ASN.1 encoder not to omit empty substrate produced for inner
component if the inner component belongs to the simple class (as
- opposed to constructed class).
+ opposed to constructed class)
- Fixed CER/DER encoders to respect tagged CHOICE when ordering
SET components
- Fixed ASN.1 types not to interfere with the Pickle protocol
+- Fixed Sequence/SequenceOf types decoding heuristics in schema-less
+ decoding mode
Revision 0.3.7, released 04-10-2017
-----------------------------------
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py
index 588d343..e8c439d 100644
--- a/pyasn1/codec/ber/decoder.py
+++ b/pyasn1/codec/ber/decoder.py
@@ -451,10 +451,9 @@ class UniversalConstructedTypeDecoder(AbstractConstructedDecoder):
# Now we have to guess is it SEQUENCE/SET or SEQUENCE OF/SET OF
# The heuristics is:
- # * 0-1 component -> likely SEQUENCE OF/SET OF
- # * 1+ components of the same type -> likely SEQUENCE OF/SET OF
- # * otherwise -> likely SEQUENCE/SET
- if len(components) > 1 or len(componentTypes) > 1:
+ # * 1+ components of different types -> likely SEQUENCE/SET
+ # * otherwise -> likely SEQUENCE OF/SET OF
+ if len(componentTypes) > 1:
protoComponent = self.protoRecordComponent
else:
protoComponent = self.protoSequenceComponent