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

converting empty rfc5280.SubjectAltName to bool raises PyAsn1Error #13

Open
oconnor663 opened this issue Feb 7, 2024 · 0 comments
Open

Comments

@oconnor663
Copy link

Here's an example script demonstrating the crash:

import pyasn1_modules
from pyasn1_modules import rfc5280

print(pyasn1_modules.__version__)

nonempty_san = rfc5280.SubjectAltName()
nonempty_san.append(rfc5280.GeneralName())
# This works fine.
bool(nonempty_san)

empty_san = rfc5280.SubjectAltName()
# This crashes.
bool(empty_san)
$ python test.py
0.3.0
Traceback (most recent call last):
  File "/tmp/test.py", line 13, in <module>
    bool(empty_san)
  File "/tmp/venv.QYC/lib/python3.9/site-packages/pyasn1/type/base.py", line 571, in __bool__
    return bool(self.components)
  File "/tmp/venv.QYC/lib/python3.9/site-packages/pyasn1/type/univ.py", line 1944, in components
    for idx in sorted(self._componentValues)]
  File "/tmp/venv.QYC/lib/python3.9/site-packages/pyasn1/type/base.py", line 213, in plug
    raise error.PyAsn1Error('Attempted "%s" operation on ASN.1 schema object' % name)
pyasn1.error.PyAsn1Error: Attempted "__iter__" operation on ASN.1 schema object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant