Skip to content

Commit

Permalink
[SUREFIRE-2058] Flip and clear output char buffer after each chunk read
Browse files Browse the repository at this point in the history
Overflow can happen even when output buffer has still some remaining space left
  • Loading branch information
zoltanmeze committed Apr 12, 2022
1 parent df35645 commit 8615d16
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,8 @@ private String readString( @Nonnull final Memento memento, @Nonnegative final in
}
while ( isLastChunk && bytesToDecode > 0 && output.hasRemaining() );

if ( isLastChunk || !output.hasRemaining() )
{
strings.add( ( (Buffer) output ).flip().toString() );
( (Buffer) output ).clear();
}
strings.add( ( (Buffer) output ).flip().toString() );
( (Buffer) output ).clear();
}

memento.getDecoder().reset();
Expand Down

0 comments on commit 8615d16

Please sign in to comment.