File smalltalk-2.1.10-xpm-sec5.patch of Package smalltalk
--- packages/blox/tk/BloxTK.c
+++ packages/blox/tk/BloxTK.c
@@ -672,7 +672,7 @@
XpmColor *colorTable;
char **defaults;
- if (ncolors >= SIZE_MAX / sizeof(XpmColor))
+ if (ncolors >= UINT_MAX / sizeof(XpmColor))
return (TCL_ERROR); /* No memory */
colorTable = (XpmColor *) malloc (ncolors * sizeof (XpmColor));
if (!colorTable)
@@ -688,7 +688,7 @@
/*
* read pixel value
*/
- if (cpp >= SIZE_MAX - 1)
+ if (cpp >= UINT_MAX - 1)
{
xpmFreeColorTable(colorTable, ncolors);
return (TCL_ERROR); /* No memory */
@@ -780,7 +780,7 @@
/*
* read pixel value
*/
- if (cpp >= SIZE_MAX - 1)
+ if (cpp >= UINT_MAX - 1)
{
xpmFreeColorTable (colorTable, ncolors);
return (TCL_ERROR); /* No memory */
@@ -871,7 +871,7 @@
unsigned int a, x, y;
if ((height > 0 && width >= SIZE_MAX / height) ||
- width * height >= SIZE_MAX / sizeof(unsigned int))
+ width * height >= UINT_MAX / sizeof(unsigned int))
return (TCL_ERROR); /* No memory */
iptr2 = (unsigned int *) malloc (sizeof (unsigned int) * width * height);
if (!iptr2)
@@ -923,7 +923,7 @@
/* array of pointers malloced by need */
unsigned int *crgb[256];
- int char1, a2;
+ unsigned int char1, a2;
memset (crgb, 0, 256 * sizeof (unsigned int *)); /* init */
for (a = 0; a < ncolors; a++)