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

Fix leaking field name text in IonCursorBinary #859

Merged
merged 2 commits into from
May 15, 2024

Conversation

popematt
Copy link
Contributor

Issue #, if available:

None

Description of changes:

There is a bug that I discovered where Ion 1.1 binary data such as E0 01 01 EA FD 0F 01 FF 61 D3 09 A1 62 (equivalent to $ion_1_1 {a:{$4:b}}) is interpreted incorrectly. The field text from a was not properly being reset and was leaking into the next field name, so that even though $4 was being parsed correctly the reader would see that field text was available and return that instead. I was only able to reproduce this for cases such as mentioned above where there is a field name with inline text and then the first nested field inside that value is a SID field name.

The bug was fixed by clearing fieldTextMarker in the reset() method. Since this is the second such bug I've found related to things not being cleared in the reset() method, I also decided to preemptively add a few more things to the reset() method in the hopes that it will spare us from some obscure problem in the future.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@popematt popematt requested a review from tgregg May 15, 2024 18:07
Copy link

codecov bot commented May 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (ion-11-encoding@9b17d94). Click here to learn what that means.

Additional details and impacted files
@@                Coverage Diff                 @@
##             ion-11-encoding     #859   +/-   ##
==================================================
  Coverage                   ?   68.82%           
  Complexity                 ?     6221           
==================================================
  Files                      ?      182           
  Lines                      ?    25104           
  Branches                   ?     4470           
==================================================
  Hits                       ?    17278           
  Misses                     ?     6468           
  Partials                   ?     1358           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@popematt popematt requested a review from tgregg May 15, 2024 20:07
@popematt popematt merged commit 4a97f72 into amazon-ion:ion-11-encoding May 15, 2024
21 of 36 checks passed
@popematt popematt deleted the fix-leaking-field-state branch May 15, 2024 21:26
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

Successfully merging this pull request may close these issues.

2 participants