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

ion_reader_step_out assertion fails on incomplete container #355

Open
rmarrowstone opened this issue Jan 7, 2025 · 0 comments
Open

ion_reader_step_out assertion fails on incomplete container #355

rmarrowstone opened this issue Jan 7, 2025 · 0 comments
Labels

Comments

@rmarrowstone
Copy link
Contributor

ion_reader_next indicates the end of a container by setting the passed ION_TYPE reference to tid_EOF, regardless of whether the end of that container was expected (and the container valid) or the stream incomplete.

When a caller attempts to step out of the container, the ION_ASSERT condition in _ion_reader_binary_step_out is true. Depending on whether ion-c is built in debug or release this may result in a failed assertion or an infinite loop.

It seems totally reasonable for me as a user that I should be able to try to step out of the container in this case, and reliably get an error in the case of premature stream end.

This is the apparent cause of amazon-ion/ion-python#398

rmarrowstone added a commit that referenced this issue Jan 7, 2025
This change replaces what is an assertion failure with a returned
error when the user attempts to step out of an Ion Container that
was not completed before the stream ended.

The issue is causing ion-python loads to hang for this case.

GH #355
rmarrowstone added a commit that referenced this issue Jan 9, 2025
* Replace Assertion Failure with Error for Premature Container Ends

This change replaces what is an assertion failure with a returned
error when the user attempts to step out of an Ion Container that
was not completed before the stream ended.

The issue is causing ion-python loads to hang for this case.

GH #355

* Add check for valid state in reader next as well

I realized the text reader also throws an error when the user tries
to get the next value from within the container. That seems right
to me as well, so I added a check there and then a test to prove
consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant