cvs: gd /libgd/src gd_tga.c

[email protected] ("Mattias Bengtsson") Tue, 16 Oct 2007 22:05:55 -0000
Newsgroups php.gd.cvs
Message-ID <cvsmattias1192572355@cvsserver>
mattias		Tue Oct 16 22:05:55 2007 UTC

  Modified files:              
    /gd/libgd/src	gd_tga.c 
  Log:
  - Overflow check
  
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_tga.c?r1=1.6&r2=1.7&diff_format=u
Index: gd/libgd/src/gd_tga.c
diff -u gd/libgd/src/gd_tga.c:1.6 gd/libgd/src/gd_tga.c:1.7
--- gd/libgd/src/gd_tga.c:1.6	Tue Oct 16 21:59:16 2007
+++ gd/libgd/src/gd_tga.c	Tue Oct 16 22:05:55 2007
@@ -197,6 +197,14 @@
 	int j = 0;
 	byte encoded_pixels;
 
+	if(overflow2(tga->width, tga->height)) {
+		return -1;
+	}
+
+	if(overflow2(tga->width * tga->height, pixel_block_size)) {
+		return -1;
+	}
+
 	/*!	\brief Allocate memmory for image block
 	 *  Allocate a chunk of memory for the image block to be passed into.
 	 */