Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in forEachByte on nested composite bytebuf with leak detection #12790

Merged
merged 1 commit into from Sep 9, 2022

Conversation

chrisvest
Copy link
Contributor

Motivation:
An NPE could occur when forEachByte was called on nested leak-aware composite byte buffers.

Modification:
WrappedCompositeByteBuf extends CompositeByteBuf but must delegate all calls to the wrapped instance. Add delegation calls for forEachByteAsc0 and forEachByteDesc0. Without delegation, those calls would, from an outer composite buffer, go to the composite structure of the wrapper buffer, which have no components.

Result:
No more NPE when calling forEachByte on nested composite leak-aware buffers.

Fixes #12787

Motivation:
An NPE could occur when forEachByte was called on nested leak-aware composite byte buffers.

Modification:
WrappedCompositeByteBuf extends CompositeByteBuf but must delegate all calls to the wrapped instance.
Add delegation calls for forEachByteAsc0 and forEachByteDesc0.
Without delegation, those calls would, from an outer composite buffer, go to the composite structure of the wrapper buffer, which have no components.

Result:
No more NPE when calling forEachByte on nested composite leak-aware buffers.

Fixes netty#12787
@chrisvest chrisvest merged commit 1440435 into netty:4.1 Sep 9, 2022
@chrisvest chrisvest added this to the 4.1.82.Final milestone Sep 9, 2022
@chrisvest chrisvest deleted the 41-composite-bytebuf-processor branch September 9, 2022 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE with Paranoid leak detector and using a ByteProcessor on a CompositeBuffer of CompositeBuffer
1 participant