cvs: gd /libgd gd_security.c

From: Date: Wed, 08 Aug 2007 15:18:20 +0000
Subject: cvs: gd /libgd gd_security.c
Groups: php.gd.cvs 
Request: Send a blank email to php-gd-cvs+get-258@lists.php.net to get a copy of this message
mattias Wed Aug 8 15:18:20 2007 UTC Modified files: /gd/libgd gd_security.c Log: - Be paranoid and dont allow multiplication with zero http://cvs.php.net/viewvc.cgi/gd/libgd/gd_security.c?r1=1.1&r2=1.2&diff_format=u Index: gd/libgd/gd_security.c diff -u gd/libgd/gd_security.c:1.1 gd/libgd/gd_security.c:1.2 --- gd/libgd/gd_security.c:1.1 Wed Apr 5 15:54:20 2006 +++ gd/libgd/gd_security.c Wed Aug 8 15:18:20 2007 @@ -19,12 +19,10 @@ int overflow2(int a, int b) { - if(a < 0 || b < 0) { - fprintf(stderr, "gd warning: one parameter to a memory allocation multiplication is negative, failing operation gracefully\n"); + if(a <= 0 || b <= 0) { + fprintf(stderr, "gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n"); return 1; } - if(b == 0) - return 0; if(a > INT_MAX / b) { fprintf(stderr, "gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"); return 1;

« previous php.gd.cvs (#258) next »