* malloc/malloc.c (_int_free): Further free () protection checks.

This commit is contained in:
Jakub Jelinek 2004-11-15 09:49:06 +00:00
parent b3c20a361d
commit a52ef8e416

View File

@ -4233,6 +4233,14 @@ _int_free(mstate av, Void_t* mem)
#endif
) {
if (__builtin_expect (chunksize (chunk_at_offset (p, size)) < MINSIZE, 0)
|| __builtin_expect (chunksize (chunk_at_offset (p, size))
>= av->system_mem, 0))
{
errstr = "invalid next size (fast)";
goto errout;
}
set_fastchunks(av);
fb = &(av->fastbins[fastbin_index(size)]);
/* Another simple check: make sure the top of the bin is not the