Skip to content

Port "gd2: use existing overflow2() rather than ad-hoc version" #15090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/gd/libgd/gd_gd2.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
GD2_DBG(gd_error("%d Chunks vertically", *ncy));

if (gd2_compressed(*fmt)) {
if (*ncx <= 0 || *ncy <= 0 || *ncx > INT_MAX / *ncy) {
if (overflow2(*ncx, *ncy)) {
GD2_DBG(printf ("Illegal chunk counts: %d * %d\n", *ncx, *ncy));
goto fail1;
}
Expand Down
2 changes: 2 additions & 0 deletions ext/gd/tests/bug73869.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869a.gd2'));
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869b.gd2'));
?>
--EXPECTF--
%A
Warning: imagecreatefromgd2(): "%s" is not a valid GD2 file in %s on line %d
bool(false)

%A
Warning: imagecreatefromgd2(): "%s" is not a valid GD2 file in %s on line %d
bool(false)
Loading