-
Notifications
You must be signed in to change notification settings - Fork 200
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
Unexpected FieldTypeEnum while parsing specific jpegs #523
Comments
The core problem lies in a fact that Python enum implementation throws an exception on encountering of value not specified in enum. Majority of other languages just treat it as There are 2 ways to solve that specific problem you're mentioning:
|
Hi! Thanks for looking into this. |
IMHO just a function returning either an |
JFYI, a similar thing already exists in Ruby runtime: https://github.com/kaitai-io/kaitai_struct_ruby_runtime/blob/master/lib/kaitai/struct/struct.rb#L478-L483 We just need similar one for Python. |
Python-related problem fixed in kaitai-io/kaitai_struct_compiler@5039401 New test is called "enum_invalid": http://kaitai.io/ci/ci.html Eventually to be implemented for all languages. |
Test passes for all languages. Please reopen if any problems still remain. |
Hi! While parsing this JPEG with mitmproxy.
Traceback I got:
File "mitmproxy/contentviews/__init__.py", line 130, in get_content_view ERROR File "mitmproxy/contentviews/auto.py", line 17, in __call__ ERROR File "mitmproxy/contentviews/image/view.py", line 36, in __call__ ERROR File "mitmproxy/contentviews/image/image_parser.py", line 78, in parse_jpeg ERROR File "mitmproxy/contrib/kaitaistruct/exif_be.py", line 572, in ifd0 ERROR File "mitmproxy/contrib/kaitaistruct/exif_be.py", line 31, in __init__ ERROR File "mitmproxy/contrib/kaitaistruct/exif_be.py", line 522, in __init__ ERROR File "enum.py", line 291, in __call__ ERROR File "enum.py", line 533, in __new__ ERROR File "enum.py", line 546, in _missing_ ERROR ValueError: 9 is not a valid FieldTypeEnum ERROR
I think the main issue lies here. An unexpected FieldTypeEnum 9 is generated and throws error when
field_type
gets updated.Would be glad to make changes to fix this.
The text was updated successfully, but these errors were encountered: