gdImagePtr dst;
int y;
- /* check size */
- if (crop->width<=0 || crop->height<=0) {
- return NULL;
- }
-
/* allocate the requested size (could be only partially filled) */
if (src->trueColor) {
dst = gdImageCreateTrueColor(crop->width, crop->height);
+ if (dst == NULL) {
+ return NULL;
+ }
gdImageSaveAlpha(dst, 1);
} else {
dst = gdImageCreate(crop->width, crop->height);
+ if (dst == NULL) {
+ return NULL;
+ }
gdImagePaletteCopy(dst, src);
}
- if (dst == NULL) {
- return NULL;
- }
dst->transparent = src->transparent;
/* check position in the src image */
// POC #4
var_dump(imagecrop($img, array("x" => 0x7fffff00, "y" => 0, "width" => 10, "height" => 10)));
+// bug 66815
+var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" => 65535)));
?>
--EXPECTF--
resource(%d) of type (gd)
[width] => 10
[height] => 10
)
+
+Warning: imagecrop(): gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
+ in %sbug66356.php on line %d
bool(false)
resource(%d) of type (gd)
-resource(%d) of type (gd)
\ No newline at end of file
+resource(%d) of type (gd)
+
+Warning: imagecrop(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+ in %sbug66356.php on line %d
+bool(false)
\ No newline at end of file