Skip to content

Clamp reads to not overrun the remaining size of the ISO. - #184

Merged
clalancette merged 1 commit into
masterfrom
clalancette/clamp-reads
Aug 24, 2026
Merged

Clamp reads to not overrun the remaining size of the ISO.#184
clalancette merged 1 commit into
masterfrom
clalancette/clamp-reads

Conversation

@clalancette

Copy link
Copy Markdown
Owner

Many of the values on an ISO are 32-bit values that could be manipulated or otherwise be bogus. If that happened, we could erroneously allocate a large buffer and attempt to read past the end of the ISO. While this would only be a virtual memory allocation in the default Linux setup, there is no reason to allow allocating beyond the end of the ISO itself. Add in a new read_clamped helper which will return a short read if the read would go past the end of the ISO. Also add in tests.

Reported by, and initial fix proposed by: mohammad adnan (cystack.ps redteam)

Fixes #182

Many of the values on an ISO are 32-bit values that could
be manipulated or otherwise be bogus.  If that happened,
we could erroneously allocate a large buffer and attempt
to read past the end of the ISO.  While this would only
be a virtual memory allocation in the default Linux setup,
there is no reason to allow allocating beyond the end of
the ISO itself.  Add in a new read_clamped helper which
will return a short read if the read would go past the
end of the ISO.  Also add in tests.

Reported by, and initial fix proposed by: mohammad adnan (cystack.ps redteam)

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@clalancette
clalancette force-pushed the clalancette/clamp-reads branch from 18110f4 to 74983c4 Compare August 24, 2026 23:04
@clalancette
clalancette merged commit 59bdd86 into master Aug 24, 2026
5 checks passed
@clalancette
clalancette deleted the clalancette/clamp-reads branch August 24, 2026 23:07
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.

Security: request to open a private disclosure channel

1 participant