]> granicus.if.org Git - php/commitdiff
Fix overflow checks
authorChristoph M. Becker <cmbecker69@gmx.de>
Fri, 30 Sep 2016 18:15:15 +0000 (20:15 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 30 Sep 2016 18:15:15 +0000 (20:15 +0200)
We check for the proper sizeofs, cf.
<https://github.com/libgd/libgd/commit/c3cf674c>.

ext/gd/libgd/gd.c

index 464f8d5b7aad2a67d84111b7221dc9c2e3691a53..508d66fc74c19c903d9a19079cdd3060068af6ff 100644 (file)
@@ -125,12 +125,10 @@ gdImagePtr gdImageCreate (int sx, int sy)
        if (overflow2(sx, sy)) {
                return NULL;
        }
-
        if (overflow2(sizeof(unsigned char *), sy)) {
                return NULL;
        }
-
-       if (overflow2(sizeof(unsigned char *), sx)) {
+       if (overflow2(sizeof(unsigned char), sx)) {
                return NULL;
        }
 
@@ -181,12 +179,10 @@ gdImagePtr gdImageCreateTrueColor (int sx, int sy)
        if (overflow2(sx, sy)) {
                return NULL;
        }
-
-       if (overflow2(sizeof(unsigned char *), sy)) {
+       if (overflow2(sizeof(int *), sy)) {
                return NULL;
        }
-
-       if (overflow2(sizeof(int *), sx)) {
+       if (overflow2(sizeof(int), sx)) {
                return NULL;
        }