Skip to content

fix(filesystem): overflow-safe bounds check in IOMemReader::pread#5262

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

fix(filesystem): overflow-safe bounds check in IOMemReader::pread#5262
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-pread

Conversation

@lgritz

@lgritz lgritz commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

IOMemReader::pread guarded its memcpy with size + size_t(offset) > m_buf.size(). For a large or negative offset, that addition wraps around size_t and can compare as in-bounds, skipping both the error path and the size clamp, so the memcpy reads past (or before) the buffer.

Assisted-by: Claude Code / Claude Opus 4.8

IOMemReader::pread guarded its memcpy with `size + size_t(offset) >
m_buf.size()`. For a large or negative offset, that addition wraps around
size_t and can compare as in-bounds, skipping both the error path and the
size clamp, so the memcpy reads past (or before) the buffer.

Assisted-by: Claude Code / Claude Opus 4.8

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz lgritz merged commit 0421dc6 into AcademySoftwareFoundation:main Jun 29, 2026
27 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