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 binary reader reads null symbol will cause invalid state failure. #223

Open
cheqianh opened this issue Jan 20, 2021 · 1 comment
Open
Labels

Comments

@cheqianh
Copy link
Contributor

When we use the binary reader to read a NULL symbol and then call the ion_reader_read_null api, it will fail with IERR_INVALID_STATE.

@cheqianh cheqianh added the bug label Jan 20, 2021
@cheqianh cheqianh changed the title Ion binary reader reads null symbol will causes invalid state failure. Ion binary reader reads null symbol will cause invalid state failure. Jan 20, 2021
@cheqianh
Copy link
Contributor Author

// reproduction for amzn/ion-c#223
TEST(IonBinarySymbol, BinarySymbolIsNullAfterReadNext) {

    // Wrtie binary $0
    hWRITER writer = NULL;
    ION_STREAM *ion_stream = NULL;
    BYTE *data;
    SIZE data_length;
    BOOL is_binary = true;

    ION_ASSERT_OK(ion_test_new_writer(&writer, &ion_stream, is_binary));
    ION_ASSERT_OK(_ion_writer_binary_write_symbol_id(writer, 0));
    ION_ASSERT_OK(ion_test_writer_get_bytes(writer, ion_stream, &data, &data_length));

    // Read

    hREADER reader = NULL;
    ION_TYPE type;
    ION_TYPE null_type;

    ION_ASSERT_OK(ion_test_new_reader(data, data_length, &reader));

    ION_ASSERT_OK(ion_reader_next(reader, &type));
    
    ION_ASSERT_OK(ion_reader_read_null(reader, &null_type));
    ION_ASSERT_OK(ion_reader_close(reader));
}

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