mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
Handle overflow in __hcreate_r
Hi, As in bugzilla entry there is overflow in hsearch when looking for prime number as SIZE_MAX - 1 is divisible by 5. We fix that by rejecting large inputs before looking for prime. * misc/hsearch_r.c (__hcreate_r): Handle overflow.
This commit is contained in:
parent
0d0325ed4b
commit
2f5c175055
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2015-08-25 Ondřej Bílka <neleai@seznam.cz>
|
||||
|
||||
* debug/strcpy_chk.c: Improve performance.
|
||||
* debug/stpcpy_chk.c: Likewise.
|
||||
* sysdeps/x86_64/strcpy_chk.S: Remove.
|
||||
* sysdeps/x86_64/stpcpy_chk.S: Remove.
|
||||
|
||||
[BZ #18240]
|
||||
* misc/hsearch_r.c (__hcreate_r): Handle overflow.
|
||||
|
||||
2015-08-25 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
[BZ #15128]
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <search.h>
|
||||
|
||||
/* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
|
||||
@ -73,6 +73,13 @@ __hcreate_r (nel, htab)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nel >= SIZE_MAX / sizeof (_ENTRY))
|
||||
{
|
||||
__set_errno (ENOMEM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* There is still another table active. Return with error. */
|
||||
if (htab->table != NULL)
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user