GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — Auto-port 4.1: Add missing bounds check to `AdaptiveByteBuf.getBytes(...)` channel variants by netty-project-bot · Pull Request #17629 · netty/netty Conversation
Contributor
Auto-port of #17620 to 4.1 Motivation:
These methods write from the cached Modification: Add the missing Result:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…ariants (#17620) Motivation: `AdaptiveByteBuf.getBytes(int, GatheringByteChannel, int)` and `AdaptiveByteBuf.getBytes(int, FileChannel, long, int)` do not call `checkIndex(index, length)`, unlike other `ByteBuf` implementations. These methods write from the cached `tmpNioBuf`, whose limit is `maxFastCapacity` (the size of the underlying segment) rather than `capacity()`. An out-of-bounds request that still fits within the segment is therefore not rejected: instead of throwing `IndexOutOfBoundsException`, the buffer silently writes bytes located beyond its own capacity to the channel. Modification: Add the missing `checkIndex(index, length)` to both methods, and add tests covering both channel variants. Result: `AdaptiveByteBuf` no longer reads past its capacity, and throws `IndexOutOfBoundsException` like the other `ByteBuf` implementations. (cherry picked from commit a0c8ddc)
|
There was an error while loading. Please reload this page.
✅ All tests passed ✅🏷️ Commit: 2bed2f0 Learn more about TestLens at testlens.app/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…...)` channel variants (netty#17629) Auto-port of netty#17620 to 4.1 Cherry-picked commit: a0c8ddc --- Motivation: `AdaptiveByteBuf.getBytes(int, GatheringByteChannel, int)` and `AdaptiveByteBuf.getBytes(int, FileChannel, long, int)` do not call `checkIndex(index, length)`, unlike other `ByteBuf` implementations. These methods write from the cached `tmpNioBuf`, whose limit is `maxFastCapacity` (the size of the underlying segment) rather than `capacity()`. An out-of-bounds request that still fits within the segment is therefore not rejected: instead of throwing `IndexOutOfBoundsException`, the buffer silently writes bytes located beyond its own capacity to the channel. Modification: Add the missing `checkIndex(index, length)` to both methods, and add tests covering both channel variants. Result: `AdaptiveByteBuf` no longer reads past its capacity, and throws `IndexOutOfBoundsException` like the other `ByteBuf` implementations. --------- Co-authored-by: old driver <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.