-
Notifications
You must be signed in to change notification settings - Fork 114
Fixes Ion Binary Reader to fail fast when an IVM type code is encountered in an illegal position #397
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #397 +/- ##
=========================================
Coverage 66.35% 66.35%
- Complexity 5361 5362 +1
=========================================
Files 154 154
Lines 22622 22624 +2
Branches 4083 4084 +1
=========================================
+ Hits 15010 15013 +3
+ Misses 6254 6253 -1
Partials 1358 1358
Continue to review full report at Codecov.
|
It's really hard for me to tell why this fixes the problem. Why is the reader returning a Also, for changes to |
It is actually in a struct... but someone managed to devise an invalid input that tricks the ion reader into thinking there's a symbol with a null field name. Here's the input:
There's a number of issues with this input. The length codes for all of the containers are wrong. It also looks like someone took the first 8 bytes (including the IVM) and repeated them again at position 41, in the middle of a struct. After looking into it more, it seems like the root cause is actually that IVMs are not handled correctly inside containers. When Here we see that any time
Right. I forgot about that. |
I managed to come up with a minimal, complete example of the bad data. See amazon-ion/ion-tests#74 |
I suspect the better fix is to throw an error here unless the reader is at depth zero. E.g.
|
Yes. That's what I realized when I looked into it more. I haven't pushed an updated PR though because I'm waiting to get the tests updated first. |
…ered in an illegal position
Issue #, if available:
#395
Description of changes:
NullPointerException
inIonParser.nextToken()
FasterXML/jackson-dataformats-binary#303 toamzn/ion-tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.