diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-17 08:58:20 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-17 08:58:20 +0000 |
commit | c3ba808aef8fcf59b04eb959e9958159648eae8a (patch) | |
tree | 398524d47808bbe1dd299f0dee99c0508c88d7af /src/hashtab.c | |
parent | 942f06393a915ff354c57d3efae651dca2b3bc75 (diff) | |
download | xorg-lib-libXpm-c3ba808aef8fcf59b04eb959e9958159648eae8a.tar.gz |
Import XORG-6_8_1 to CYGWIN branchCYGWIN-6_8_1-MERGE
Diffstat (limited to 'src/hashtab.c')
-rw-r--r-- | src/hashtab.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hashtab.c b/src/hashtab.c index 7d596ec..f07cb6d 100644 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -135,7 +135,7 @@ 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; @@ -144,6 +144,8 @@ HashTableGrows(table) HASH_TABLE_GROWS table->size = size; table->limit = size / 3; + if (size >= SIZE_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 >= SIZE_MAX / sizeof(*atomTable)) + return (XpmNoMemory); atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable)); if (!atomTable) return (XpmNoMemory); |