Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyasn1/coded/ber: Fix regressions dealing with component == None #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Apr 5, 2024

  1. pyasn1/coded/ber: Fix regressions dealing component == None

    since commit 4f644c5
    
      #!/usr/bin/env python3
      import sys, os.path, io, string
      import base64
    
      from pyasn1.codec.der.decoder import decode as pyasn1_der_decode
    
      def main ():
          blob = "fk8wTaADAgEFoQMCAR6kERgPMjAyMzA2MDYxMDAxMTlapQU"\
                  "CAwIstqYDAgEsqRUbEzx1bnNwZWNpZmllZCByZWFsbT6qCzAJoAMCAQChAjAA"
          obj, _ = pyasn1_der_decode(base64.b64decode(blob))
      if __name__ == '__main__':
          main()
    
    results in
    
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 2003, in __call__
        for asn1Object in streamingDecoder:
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 1918, in __iter__
        for asn1Object in self._singleItemDecoder(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 1778, in __call__
        for value in concreteDecoder.valueDecoder(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 99, in valueDecoder
        for value in decodeFun(substrate, asn1Spec, tagSet, length, **options):
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 1778, in __call__
        for value in concreteDecoder.valueDecoder(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 660, in valueDecoder
        for asn1Object in self._decodeComponentsSchemaless(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 596, in _decodeComponentsSchemaless
        for component in decodeFun(substrate, **options):
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 1778, in __call__
        for value in concreteDecoder.valueDecoder(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 99, in valueDecoder
        for value in decodeFun(substrate, asn1Spec, tagSet, length, **options):
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 1778, in __call__
        for value in concreteDecoder.valueDecoder(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 660, in valueDecoder
        for asn1Object in self._decodeComponentsSchemaless(
      File "/home/tux/pyasn1/pyasn1/codec/ber/decoder.py", line 604, in _decodeComponentsSchemaless
        componentTypes.add(component.tagSet)
    AttributeError: 'NoneType' object has no attribute 'tagSet'
    
    This change restores the previous code that will avoid this error.
    
    Signed-off-by: Noel Power <noel.power@suse.com>
    noelpower committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    de17ad3 View commit details
    Browse the repository at this point in the history