mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-26 04:31:03 +00:00
malloc: Print error when oldsize is not equal to the current size.
This is used to detect errors early. The read of the oldsize is not protected by any lock, so check this value to avoid causing bigger mistakes. Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
parent
de477abcaa
commit
774d43f27d
@ -4803,7 +4803,8 @@ _int_realloc (mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
|
||||
|
||||
/* oldmem size */
|
||||
if (__builtin_expect (chunksize_nomask (oldp) <= CHUNK_HDR_SZ, 0)
|
||||
|| __builtin_expect (oldsize >= av->system_mem, 0))
|
||||
|| __builtin_expect (oldsize >= av->system_mem, 0)
|
||||
|| __builtin_expect (oldsize != chunksize (oldp), 0))
|
||||
malloc_printerr ("realloc(): invalid old size");
|
||||
|
||||
check_inuse_chunk (av, oldp);
|
||||
|
Loading…
Reference in New Issue
Block a user