Skip to content

Fix GH-20582: Heap Buffer Overflow in iptcembed - #20591

Closed
ndossche wants to merge 1 commit into
php:PHP-8.3from
ndossche:fix-20582
Closed

ndossche wants to merge 1 commit into
php:PHP-8.3from
ndossche:fix-20582

Conversation

@ndossche

Copy link
Copy Markdown
Member

If you can extend the file between the file size gathering (resulting in a buffer allocation), and reading / writing to the file you can trigger a TOC-TOU where you write out of bounds.
To solve this, add extra bound checks and make sure that write actions always fail when going out of bounds.
The easiest way to trigger this is via a pipe, which is used in the test, but it should be possible with a regular file and a quick race condition as well.

If you can extend the file between the file size gathering (resulting in
a buffer allocation), and reading / writing to the file you can trigger a
TOC-TOU where you write out of bounds.
To solve this, add extra bound checks and make sure that write actions
always fail when going out of bounds.
The easiest way to trigger this is via a pipe, which is used in the
test, but it should be possible with a regular file and a quick race
condition as well.
@ndossche ndossche linked an issue Nov 25, 2025 that may be closed by this pull request
@ndossche
ndossche marked this pull request as ready for review November 25, 2025 22:42
@ndossche
ndossche requested a review from bukka as a code owner November 25, 2025 22:42
@ndossche ndossche closed this in 99ed66b Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heap Buffer Overflow in iptcembed

2 participants