]> granicus.if.org Git - php/commitdiff
Port gdImageSetStyle() overflow check from libgd 2.0.29
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 19 Sep 2016 14:49:06 +0000 (16:49 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 19 Sep 2016 14:56:07 +0000 (16:56 +0200)
ext/gd/libgd/gd.c

index 57c0aeafb10e68a5eeee1abb6555b904de222d55..7a0af8de9209c259d07547917dbf86a19b5630a5 100644 (file)
@@ -2789,6 +2789,9 @@ void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels)
        if (im->style) {
                gdFree(im->style);
        }
+       if (overflow2(sizeof (int), noOfPixels)) {
+               return;
+       }
        im->style = (int *) gdMalloc(sizeof(int) * noOfPixels);
        memcpy(im->style, style, sizeof(int) * noOfPixels);
        im->styleLength = noOfPixels;