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

Loads Hangs on Truncated Ion Container #398

Closed
rmarrowstone opened this issue Jan 7, 2025 · 2 comments · Fixed by #399
Closed

Loads Hangs on Truncated Ion Container #398

rmarrowstone opened this issue Jan 7, 2025 · 2 comments · Fixed by #399
Labels

Comments

@rmarrowstone
Copy link
Contributor

When using the c extension on an Ion Value Stream that ends prematurely within an Ion Container, but not within a scalar value inside it, loads hangs indefinitely.

For example:

import amazon.ion.simpleion as ion 
ion.loads(b'\xe0\x01\x00\xea\xb6') # a 6 octet list is declared, stream ends before value is provided

premature ends within scalars appears to work fine:

ion.loads(b'\xe0\x01\x00\xea!') # a top-level Ion Int is declared, stream ends before value is provided
ion.loads(b'\xe0\x01\x00\xea\xb2!') # value within a 6 octet list ends prematurely itself.

It looks like there needs to be a check in ioncmodule.c for this. I suspect the root of the problem there is that ion-c returns tid_EOF for both EOF and end of each container. So an EOF is expected within a container.

@rmarrowstone
Copy link
Contributor Author

Created amazon-ion/ion-c#355 which appears to be the cause.

@rmarrowstone
Copy link
Contributor Author

I have merged a fix for this in ion-c. Folks who are relying on PyPI and/or built wheels will need to wait for a new release.

I'm going to update the submodule, once that is done then folks who are building from source can get the fix until it is actually released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant