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

Pattern AST creation bug with object path numeric index steps #437

Closed
chisholm opened this issue Jul 24, 2020 · 1 comment
Closed

Pattern AST creation bug with object path numeric index steps #437

chisholm opened this issue Jul 24, 2020 · 1 comment
Assignees

Comments

@chisholm
Copy link
Contributor

from stix2.pattern_visitor import create_pattern_object

ast = create_pattern_object(pattern="[a:b[1]=2]")

print(ast)

results in a long stacktrace ending with:

  File "C:\Programming\python\stix\cti-python-stix2\stix2\pattern_visitor.py", line 262, in visitObjectPath
    return self.instantiate("ObjectPath", children[0].getText(), property_path)
  File "C:\Programming\python\stix\cti-python-stix2\stix2\pattern_visitor.py", line 69, in instantiate
    return klass_to_instantiate(*args)
  File "C:\Programming\python\stix\cti-python-stix2\stix2\patterns.py", line 314, in __init__
    self.property_path = [
  File "C:\Programming\python\stix\cti-python-stix2\stix2\patterns.py", line 316, in <listcomp>
    _ObjectPathComponent.create_ObjectPathComponent(x)
  File "C:\Programming\python\stix\cti-python-stix2\stix2\patterns.py", line 251, in create_ObjectPathComponent
    if component_name.endswith("_ref"):
AttributeError: 'IntegerConstant' object has no attribute 'endswith'
@clenk
Copy link
Contributor

clenk commented Aug 10, 2020

Fixed in #438.

@clenk clenk closed this as completed Aug 10, 2020
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

3 participants