summaryrefslogtreecommitdiff
path: root/src/hashtab.c
diff options
context:
space:
mode:
authorDeron Johnson <deron.johnson@sun.com>2005-02-17 22:44:24 +0000
committerDeron Johnson <deron.johnson@sun.com>2005-02-17 22:44:24 +0000
commit5b2b384c319513d102de3e009e1816399d93b81a (patch)
treef215864d9e5c09faa8d1399349f02c724341e2de /src/hashtab.c
parent2773a7214e282f6f673483f5233b880505947c3f (diff)
downloadxorg-lib-libXpm-5b2b384c319513d102de3e009e1816399d93b81a.tar.gz
Diffstat (limited to 'src/hashtab.c')
-rw-r--r--src/hashtab.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/hashtab.c b/src/hashtab.c
index 7d596ec..f5a71dd 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -135,15 +135,17 @@ HashTableGrows(table)
xpmHashTable *table;
{
xpmHashAtom *atomTable = table->atomTable;
- int size = table->size;
+ unsigned int size = table->size;
xpmHashAtom *t, *p;
int i;
- int oldSize = size;
+ unsigned int oldSize = size;
t = atomTable;
HASH_TABLE_GROWS
table->size = size;
table->limit = size / 3;
+ if (size >= UINT_MAX / sizeof(*atomTable))
+ return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(size * sizeof(*atomTable));
if (!atomTable)
return (XpmNoMemory);
@@ -204,6 +206,8 @@ xpmHashTableInit(table)
table->size = INITIAL_HASH_SIZE;
table->limit = table->size / 3;
table->used = 0;
+ if (table->size >= UINT_MAX / sizeof(*atomTable))
+ return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable));
if (!atomTable)
return (XpmNoMemory);