Skip to content

Commit

Permalink
Corrects handling of the return value of IonCursorBinary.slowReadMacr…
Browse files Browse the repository at this point in the history
…oInvocationHeader.
  • Loading branch information
tgregg committed Jun 26, 2024
1 parent b2d2964 commit 3928f17
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/com/amazon/ion/impl/IonCursorBinary.java
Original file line number Diff line number Diff line change
Expand Up @@ -2346,12 +2346,17 @@ private boolean slowReadHeader(final int typeIdByte, final boolean isAnnotated,
}
return true;
}
if (minorVersion == 1 && valueTid.isNull && valueTid.length > 0) {
int nullTypeIndex = slowReadByte();
if (nullTypeIndex < 0) {
if (minorVersion == 1) {
if (valueTid.isMacroInvocation) {
return true;
}
markerToSet.typeId = IonTypeID.NULL_TYPE_IDS_1_1[nullTypeIndex];
if (valueTid.isNull && valueTid.length > 0) {
int nullTypeIndex = slowReadByte();
if (nullTypeIndex < 0) {
return true;
}
markerToSet.typeId = IonTypeID.NULL_TYPE_IDS_1_1[nullTypeIndex];
}
}
if (checkpointLocation == CheckpointLocation.AFTER_SCALAR_HEADER) {
return true;
Expand Down Expand Up @@ -2468,8 +2473,7 @@ private boolean slowReadValueHeader(IonTypeID valueTid, boolean isAnnotated, Mar
// macro ID, rather than the length, as the first FlexUInt following the opcode. Therefore, for opcode
// 0xF5, `valueLength` below refers to the ID of the invocation. For the other macro invocation opcodes,
// this value is not used.
slowReadMacroInvocationHeader(valueTid, markerToSet, valueLength);
return true;
return slowReadMacroInvocationHeader(valueTid, markerToSet, valueLength);
} else {
setCheckpoint(CheckpointLocation.AFTER_SCALAR_HEADER);
event = Event.START_SCALAR;
Expand Down

0 comments on commit 3928f17

Please sign in to comment.