Skip to content

Dirty#2

Closed
trufae wants to merge 2 commits intomainfrom
dirty
Closed

Dirty#2
trufae wants to merge 2 commits intomainfrom
dirty

Conversation

@trufae
Copy link
Copy Markdown
Owner

@trufae trufae commented Jan 8, 2026

No description provided.

radare added 2 commits January 8, 2026 09:10
The zstd implementation had a critical buffer overflow bug when updating the
window buffer. When copying data to the circular window buffer, the code did not
properly handle the case where the data would wrap around the buffer boundary.

For example, with a 128KB window and 65535-byte blocks, if the current position
was at 100KB, a memcpy would attempt to write past the 128KB boundary, causing
a heap buffer overflow.

This fix properly handles circular buffer wrap-around by splitting the memcpy
into two operations when necessary:
- Part 1: Copy from current position to end of buffer
- Part 2: Copy remaining data from start of buffer

This ensures the circular buffer implementation remains within bounds and fixes
the segmentation fault that occurred on Linux when compressing large files
with zstd method.
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.

2 participants