ports/graphics/gd/files/patch-gd_png.c
Dirk Meyer b3180215a4 http://people.freebsd.org/~josef/stuff/patch-gd_png.c
- fixes allocation bug for webpng (RT Ticket #159)
Submitted by:	josef
2004-11-21 12:29:31 +00:00

18 lines
473 B
C

--- gd_png.c.orig Sat Nov 20 01:30:53 2004
+++ gd_png.c Sat Nov 20 01:30:58 2004
@@ -188,6 +188,15 @@
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, NULL, NULL);
+
+ if (overflow2(sizeof (int), width))
+ {
+ return NULL;
+ }
+ if (overflow2(sizeof (int) * width, height))
+ {
+ return NULL;
+ }
if ((color_type == PNG_COLOR_TYPE_RGB) ||
(color_type == PNG_COLOR_TYPE_RGB_ALPHA))
{