Skip to content

Fix buffer overflow in compression int_test. - #975

Open
copybara-service[bot] wants to merge 1 commit into
devfrom
test_962465936
Open

Fix buffer overflow in compression int_test.#975
copybara-service[bot] wants to merge 1 commit into
devfrom
test_962465936

Conversation

@copybara-service

Copy link
Copy Markdown

Fix buffer overflow in compression int_test.

IntCodec::DecompressAndZeroPad zero-pads the output buffer up to the nearest vector lane boundary (hwy::RoundUpTo(num, Lanes(d))). In TestUnalignedOffset, allocating only num_decompressed elements for dec2 resulted in out-of-bounds writes when num_decompressed was smaller than the vector lane count, causing a heap-buffer-overflow under HWASAN.

Allocate RoundUpTo(num_decompressed, hn::Lanes(d)) elements for dec2 in TestUnalignedOffset. Additionally, pass the buffer size in bytes (num * sizeof(T)) to MaybeCheckInitialized in TestSmallDequantize.

`IntCodec::DecompressAndZeroPad` zero-pads the output buffer up to the nearest vector lane boundary (`hwy::RoundUpTo(num, Lanes(d))`). In `TestUnalignedOffset`, allocating only `num_decompressed` elements for `dec2` resulted in out-of-bounds writes when `num_decompressed` was smaller than the vector lane count, causing a heap-buffer-overflow under HWASAN.

Allocate `RoundUpTo(num_decompressed, hn::Lanes(d))` elements for `dec2` in `TestUnalignedOffset`. Additionally, pass the buffer size in bytes (`num * sizeof(T)`) to `MaybeCheckInitialized` in `TestSmallDequantize`.

PiperOrigin-RevId: 962465936
@google-cla

google-cla Bot commented Aug 11, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

0 participants