Skip to content

Loads Hangs on Truncated Ion Container #398

@rmarrowstone

Description

@rmarrowstone

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions