Skip to content

Commit

Permalink
fix: OF-2652 - prevent IllegalReferenceCountException in NettyXMPPDec…
Browse files Browse the repository at this point in the history
…oder
  • Loading branch information
AlexGidman committed Sep 5, 2023
1 parent 8c8009e commit 73e7c38
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
// Check that the buffer is not bigger than 1 Megabyte. For security reasons
// we will abort parsing when 1 Mega of queued chars was found.
if (parser.isMaxBufferSizeExceeded()) {
in.release();
if (in.refCnt() > 0) { // prevent IllegalReferenceCountException if the ByteBuf has already been deallocated.
in.release();
}
return;
}

Expand Down

0 comments on commit 73e7c38

Please sign in to comment.