Skip to content

fix(bmp): validate scanline file position before reading#5274

Merged
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-bmpfilepos
Jun 29, 2026
Merged

fix(bmp): validate scanline file position before reading#5274
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-bmpfilepos

Conversation

@lgritz

@lgritz lgritz commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

read_native_scanline computed the scanline's file position as m_bmp_header.offset + y * m_padded_scanline_size and seeked there without checking it against the file size. A corrupt header (bogus pixel-data offset or scanline size) can place that position far outside the file.

Assisted-by: Claude Code / Claude Opus 4.8

read_native_scanline computed the scanline's file position as
m_bmp_header.offset + y * m_padded_scanline_size and seeked there without
checking it against the file size. A corrupt header (bogus pixel-data
offset or scanline size) can place that position far outside the file.

Assisted-by: Claude Code / Claude Opus 4.8

Signed-off-by: Larry Gritz <lg@larrygritz.com>

@jessey-git jessey-git left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sane to do.

@lgritz lgritz merged commit 629c834 into AcademySoftwareFoundation:main Jun 29, 2026
27 checks passed
@lgritz lgritz deleted the lg-bmpfilepos branch June 29, 2026 16:48
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