Skip to content

Fix overlapping copies in CLI read-buffer coalescing - #4920

Open
terrelln wants to merge 1 commit into
meta:devfrom
terrelln:2026-11-10-overlap-memcpy
Open

terrelln wants to merge 1 commit into
meta:devfrom
terrelln:2026-11-10-overlap-memcpy

Conversation

@terrelln

Copy link
Copy Markdown
Contributor

AIO_ReadPool_consumeBytes() can advance srcBuffer into coalesceBuffer. A later refill moves the remaining bytes back to the beginning of the same buffer, so memcpy() is undefined when those ranges overlap.

Use memmove() for this compaction. A valid 17-byte stream consisting of an empty skippable frame and an empty zstd frame reproduces a 9-byte copy from coalesceBuffer + 8 under ASan.

Add a CLI regression covering test and decompression modes with async I/O enabled and disabled. Require successful decoding and empty output so sanitizer failures cannot pass as expected input errors.

AIO_ReadPool_consumeBytes() can advance srcBuffer into coalesceBuffer. A later refill moves the remaining bytes back to the beginning of the same buffer, so memcpy() is undefined when those ranges overlap.

Use memmove() for this compaction. A valid 17-byte stream consisting of an empty skippable frame and an empty zstd frame reproduces a 9-byte copy from coalesceBuffer + 8 under ASan.

Add a CLI regression covering test and decompression modes with async I/O enabled and disabled. Require successful decoding and empty output so sanitizer failures cannot pass as expected input errors.
@meta-cla meta-cla Bot added the CLA Signed label Nov 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant