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 25, 2022
1 parent a771bbb commit ef373d7
Showing 1 changed file with 2 additions and 5 deletions.
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 ef373d7

Please sign in to comment.