Skip to content

fix(partik0l): restore bounds checks in blob() to avoid heap overflow - #335

Merged
jaromil merged 1 commit into
dyne:masterfrom
hextheshadow:fix/partik0l-blob-bounds
Nov 27, 2026
Merged

jaromil merged 1 commit into
dyne:masterfrom
hextheshadow:fix/partik0l-blob-bounds

Conversation

@hextheshadow

Copy link
Copy Markdown
Contributor

Fixes a heap buffer overflow in Partik0l::blob() (CWE-122),

blob() adds a 16x16 block to the output at the (x, y) chosen by blossom(). The two bounds checks on x and y were commented out, so the block can run past the end of the output buffer. A single f0r_update() with default parameters overflows on frames of height 198 or less and on narrow frames up to height 212 (e.g. 16x199).

Fix: restore both checks. Both are needed: the y check alone leaves narrow frames overflowing. Output is unchanged for frames of at least 199x199.

Reproduce (ASan): build partik0l.cpp with -fsanitize=address and call f0r_construct(w, h) + one f0r_update() at 640x198 or 16x199 (heap-buffer-overflow in blob, line 333). Both run clean with the fix.

blob() adds a 16x16 block at the (x, y) chosen by blossom(), but the checks that keep the block inside the frame were commented out. On frames of height 198 or less, and on narrow frames up to height 212, the block is written past the end of the output buffer. Restore both checks.
@jaromil
jaromil merged commit c6a38df into dyne:master Nov 27, 2026
11 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