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 — Hash all 8-byte blocks in SipHash.macHash(...) when position is not 0 by Marti2203 · Pull Request #17974 · netty/netty Conversation
Contributor
Motivation:
Modification:
Result: The hash depends only on the remaining bytes of the buffer. Reproduction on 4.2 (5776ebc) with With this change all three hashes are This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually. 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: SipHash.macHash(ByteBuffer) loops from input.position() while offset < len, where len is the number of remaining bytes rounded down to a multiple of 8. When the position is not 0, some or all of the 8-byte blocks are skipped, so the hash depends on the position of the buffer. If the position is at least len, only the last remaining % 8 bytes and the length are hashed, and all inputs of the same length collide. ConnectionIdChannelMap uses the hash in ConnectionIdKey.hashCode() and equals(). The ids that netty creates itself and the lookup keys (slices of the packet) have position 0, but an id that comes from a buffer with a non-zero position, for example one passed to new QuicConnectionAddress(ByteBuffer) or returned by a custom QuicConnectionIdGenerator, is stored under a hash that a lookup of the same bytes does not produce. Modifications: - Loop until position + len. - Add a test that hashes the reference inputs at a non-zero position of heap and direct buffers. Result: The hash depends only on the remaining bytes of the buffer.
|
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨Test SummaryTip Inspect all details with the TestLens CLI: Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: 6b014ea Test FailuresKQueueDatagramUnicastIPv6MappedTest > testSimpleSendDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)Rerun ControlsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 KQueueDatagramUnicastIPv6MappedTest > testSimpleSendDirectByteBuf(TestInfo) Reuse successful test results: 🔲 ♻️ Only rerun the tests that failed or were muted before Click the checkbox to trigger a rerun: ☑️ Rerun jobs 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.
|
Auto-port PR for 5.0: #17982 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…sition is not 0 (#17982) Auto-port of #17974 to 5.0 Cherry-picked commit: 71ebf52 --- Motivation: `SipHash.macHash(ByteBuffer)` loops from `input.position()` while `offset < len`, where `len` is the number of remaining bytes rounded down to a multiple of 8. When the position is not 0, some or all of the 8-byte blocks are skipped, so the hash depends on the position of the buffer. If the position is at least `len`, only the last `remaining % 8` bytes and the length are hashed, and all inputs of the same length collide. `ConnectionIdChannelMap` uses the hash in `ConnectionIdKey.hashCode()` and `equals()`. The ids that netty creates itself and the lookup keys (slices of the packet) have position 0, so I don't know of a problem with the default configuration. But an id that comes from a buffer with a non-zero position, for example one passed to `new QuicConnectionAddress(ByteBuffer)` or returned by a custom `QuicConnectionIdGenerator`, is stored under a hash that a lookup of the same bytes does not produce. Modification: - Loop until `position + len`. - Add `SipHashTest.testReferenceCasesWithPosition`, which hashes the reference inputs at a non-zero position of heap and direct buffers. Result: The hash depends only on the remaining bytes of the buffer. Co-authored-by: Martin Mirchev <[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.