mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-08-04 02:08:49 -04:00
24 lines
614 B
Plaintext
24 lines
614 B
Plaintext
$NetBSD: patch-an,v 1.1 2004/12/10 09:30:42 salo Exp $
|
|
|
|
--- gdk_imlib/misc.c.orig 2002-03-04 18:06:32.000000000 +0100
|
|
+++ gdk_imlib/misc.c 2004-12-10 10:15:22.000000000 +0100
|
|
@@ -1355,11 +1355,16 @@
|
|
|
|
/*
|
|
* Make sure we don't wrap on our memory allocations
|
|
+ * we check G_MAX_INT/4 because rend.c malloc's w * h * bpp
|
|
+ * + 3 is safety margin
|
|
*/
|
|
|
|
void *_gdk_malloc_image(unsigned int w, unsigned int h)
|
|
{
|
|
- if( w > 32767 || h > 32767)
|
|
+ if (w <= 0 || w > 32767 ||
|
|
+ h <= 0 || h > 32767 ||
|
|
+ h >= (G_MAXINT/4 - 1) / w)
|
|
return NULL;
|
|
- return malloc(w * h * 3);
|
|
+ return malloc(w * h * 3 + 3);
|
|
}
|
|
+
|