summaryrefslogtreecommitdiff
path: root/src/gd_nnquant.c
diff options
context:
space:
mode:
authortabe <none@none>2008-07-30 01:53:13 +0000
committertabe <none@none>2008-07-30 01:53:13 +0000
commit84f0bdeb962b564d32f92369abe59bc912ddf98e (patch)
treed46b32151f53e6119acc53f9f6a8f858a11c5cd4 /src/gd_nnquant.c
parentea53082be1411bb3e80066dae5102876c669e05b (diff)
downloadlibgd-84f0bdeb962b564d32f92369abe59bc912ddf98e.tar.gz
check integer overflows.
Diffstat (limited to 'src/gd_nnquant.c')
-rw-r--r--src/gd_nnquant.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gd_nnquant.c b/src/gd_nnquant.c
index c9f6859..7e07160 100644
--- a/src/gd_nnquant.c
+++ b/src/gd_nnquant.c
@@ -496,6 +496,10 @@ BGD_DECLARE(gdImagePtr) gdImageNeuQuant(gdImagePtr im, const int max_color, int
* It alos lets us convert palette image, if one likes to reduce
* a palette
*/
+ if (overflow2(gdImageSX(im), gdImageSY(im))
+ || overflow2(gdImageSX(im) * gdImageSY(im), 4)) {
+ goto done;
+ }
rgba = (unsigned char *) gdMalloc(gdImageSX(im) * gdImageSY(im) * 4);
if (!rgba) {
goto done;