Skip to content

Fix uninitialized memory read in PCX loader (planes=3, bpp=8)#50

Open
fuowang wants to merge 1 commit into
danoli3:masterfrom
fuowang:master
Open

Fix uninitialized memory read in PCX loader (planes=3, bpp=8)#50
fuowang wants to merge 1 commit into
danoli3:masterfrom
fuowang:master

Conversation

@fuowang

@fuowang fuowang commented Jul 9, 2026

Copy link
Copy Markdown

Prevent information disclosure caused by reading uninitialized heap memory when width > bytes_per_line in 8-bit 3-plane PCX images. The existing MAX over-allocation only masked the out-of-bounds read but did not prevent uninitialized bytes from leaking into pixel data.

Add a validation check that rejects images where width exceeds bytes_per_line, as each plane provides only bytes_per_line bytes but the BGR expansion loop indexes by width.

CWE-457 (use of uninitialized variable)
Found during academic security research.

Fixes: #49

Prevent information disclosure caused by reading uninitialized heap
memory when width > bytes_per_line in 8-bit 3-plane PCX images.
The existing MAX over-allocation only masked the out-of-bounds read
but did not prevent uninitialized bytes from leaking into pixel data.

Add a validation check that rejects images where width exceeds
bytes_per_line, as each plane provides only bytes_per_line bytes
but the BGR expansion loop indexes by width.

CWE-457 (use of uninitialized variable)
Found during academic security research.

Fixes: danoli3#49
@danoli3

danoli3 commented Jul 9, 2026 via email

Copy link
Copy Markdown
Owner

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.

PCX loader: uninitialized memory read in planes==3, bpp==8 BGR expansion (CWE-457)

2 participants