gdImagePtr tmp_im;
gdImagePtr dst;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
/* Convert to truecolor if it isn't; this code requires it. */
if (!src->trueColor) {
gdImagePaletteToTrueColor(src);
{
gdImagePtr tmp_im;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
tmp_im = gdImageCreateTrueColor(new_width, src_height);
if (tmp_im == NULL) {
return NULL;
unsigned long dst_offset_y = 0;
unsigned int i;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
dst_img = gdImageCreateTrueColor(new_width, new_height);
if (dst_img == NULL) {
gdImagePtr new_img;
const int transparent = im->transparent;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
new_img = gdImageCreateTrueColor(new_width, new_height);
if (new_img == NULL) {
return NULL;
long i;
gdImagePtr new_img;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
new_img = gdImageCreateTrueColor(new_width, new_height);
if (!new_img){
return NULL;
unsigned int dst_offset_y = 0;
long i;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
/* impact perf a bit, but not that much. Implementation for palette
images can be done at a later point.
*/
gdImagePtr im_scaled = NULL;
if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) {
- return 0;
+ return NULL;
+ }
+
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
}
switch (src->interpolation_id) {
unsigned int i;
gdImagePtr dst;
+ if (new_width == 0 || new_height == 0) {
+ return NULL;
+ }
+
dst = gdImageCreateTrueColor(new_width, new_height);
if (!dst) {
return NULL;
--- /dev/null
+--TEST--
+ #72337 segfault in imagescale with new dimensions being <=0)
+--SKIPIF--
+<?php
+ if (!function_exists('imagescale')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(1, 1);
+imagescale($im, 0, 0, IMG_BICUBIC_FIXED);
+echo "OK";
+?>
+--EXPECT--
+OK