Skip to content

Commit

Permalink
#3775: Allow decompressed packets to grow to max capacity
Browse files Browse the repository at this point in the history
Do not use size as max capacity, as its possible that the entity
rewriter increases the size afterwards. This would result in a kick (it
happens rarely as the entity ids size must differ).
  • Loading branch information
Outfluencer authored and md-5 committed Jan 28, 2025
1 parent 6b22690 commit 4fded98
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
throw new OverflowPacketException( "Packet may not be larger than " + MAX_DECOMPRESSED_LEN + " bytes" );
}

ByteBuf decompressed = ctx.alloc().directBuffer( size, size );
// Do not use size as max capacity, as its possible that the entity rewriter increases the size afterwards
// This would result in a kick (it happens rarely as the entity ids size must differ)
ByteBuf decompressed = ctx.alloc().directBuffer( size, MAX_DECOMPRESSED_LEN );
try
{
zlib.process( in, decompressed );
Expand Down

0 comments on commit 4fded98

Please sign in to comment.