Skip to content

Fixes Ion Binary Reader to fail fast when an IVM type code is encountered in an illegal position #397

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

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ion-tests
6 changes: 6 additions & 0 deletions src/com/amazon/ion/impl/IonReaderBinaryRawX.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ private final void has_next_helper_raw() throws IOException
else if (_value_tid == _Private_IonConstants.tidTypedecl) {
assert (_value_tid == (BINARY_VERSION_MARKER_TID & 0xff)); // the bvm tid happens to be type decl
if (_value_len == BINARY_VERSION_MARKER_LEN ) {
if (getDepth() != 0) {
// In Ion text, we can interpret an IVM in the wrong position as an ordinary Symbol,
// but in Ion binary, the BVM is unambiguously an IVM rather than a Symbol, and it
// is not allowed in any container type.
throw newErrorAt("Encountered IVM type code E0 below the top level");
}
// this isn't valid for any type descriptor except the first byte
// of a 4 byte version marker - so lets read the rest
load_version_marker();
Expand Down