Skip to content

ext/gd: imagecrop rect argument overflow fixes. #18006

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
update test from feedback
  • Loading branch information
devnexen committed Mar 28, 2025
commit 617ce5d5407e687cc81ffce85dcf6f973c5d679d
8 changes: 4 additions & 4 deletions ext/gd/tests/imagecrop_overflow.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ gd
<?php
$img = imagecreatetruecolor(10, 10);

$arr = array("x" => 2147483647, "y" => 2147483647, "width" => 10, "height" => 10);
$arr = ["x" => 2147483647, "y" => 2147483647, "width" => 10, "height" => 10];

try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}

$arr = array("x" => -2147483648, "y" => 0, "width" => -10, "height" => 10);
$arr = ["x" => -2147483648, "y" => 0, "width" => -10, "height" => 10];

try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}

$arr = array("x" => 1, "y" => 2147483647, "width" => 10, "height" => 10);
$arr = ["x" => 1, "y" => 2147483647, "width" => 10, "height" => 10];

try {
imagecrop($img, $arr);
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}

$arr = array("x" => 1, "y" => -2147483648, "width" => 10, "height" => -10);
$arr = ["x" => 1, "y" => -2147483648, "width" => 10, "height" => -10];

try {
imagecrop($img, $arr);
Expand Down
Loading