Skip to content

Commit

Permalink
Fix unsigned comparison which could fail due to numeric overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nirosys committed Nov 12, 2024
1 parent 46aebb0 commit 6509ccd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/events/ion_event_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ size_t ion_event_stream_length(IonEventStream *stream, size_t index) {
// NOTE: this will break if embedded streams themselves contain embedded streams. This should be explicitly
// disallowed, as nested embedded streams are not a useful concept.
size_t end_index = index;
while (stream->size() - end_index > 0 && stream->at(end_index++)->event_type != STREAM_END);
while (end_index < stream->size() && stream->at(end_index++)->event_type != STREAM_END);
return end_index - index;
}

Expand Down

0 comments on commit 6509ccd

Please sign in to comment.