Skip to content

Fix traversal buffer size overflow - #31

Merged
tbybell merged 2 commits into
gtkwave:mainfrom
Rodrigodd:upstream/traversal-size-overflow
Oct 18, 2026
Merged

tbybell merged 2 commits into
gtkwave:mainfrom
Rodrigodd:upstream/traversal-size-overflow

Conversation

@Rodrigodd

Copy link
Copy Markdown
Contributor

Problem: A value change section can declare a traversal size near 2**64. Adding the 67 bytes of decompression and varint slack wraps the allocation size to a value smaller than 67, leading the chain decompressor to do a out-of-bounds buffer access

Solution: reject sizes that would overflow before adding the overhead. That check jumps to block_err before chain_cmem is allocated, so also initialize chain_cmem to NULL and reset it after freeing it, to avoid freeing it while uninitialized or freeing it twice.

AI-assisted

Rodrigodd and others added 2 commits October 17, 2026 17:18
Problem: A value change section can declare a traversal size near 2**64.
Adding the 67 bytes of decompression and varint slack wraps the
allocation size to a value smaller than 67, leading the chain
decompressor to do a out-of-bounds buffer access

Solution: reject sizes that would overflow before adding the overhead.
That check jumps to `block_err` before `chain_cmem` is allocated, so also
initialize `chain_cmem` to NULL and reset it after freeing it, to avoid
freeing it while uninitialized or freeing it twice.

AI-assisted
@tbybell
tbybell merged commit cc1c368 into gtkwave:main Oct 18, 2026
3 checks passed
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