diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2021-12-27 08:59:30 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2021-12-27 08:59:30 +0300 |
commit | fad9ca55111a4a7bc6952bd7b56086d472023a9e (patch) | |
tree | 1f800525db947b51f4b298b7e6fcfa2cd4dc25c6 /mallocx.c | |
parent | c87fd33b6b1a924e607e081c61e7e391edc4d21b (diff) | |
download | bdwgc-fad9ca55111a4a7bc6952bd7b56086d472023a9e.tar.gz |
Eliminate 'buffer overflow detected' FP error in realloc_test
Issue #406 (bdwgc).
* mallocx.c (GC_realloc): Pass p to BZERO() thru an intermediate
variable of word type; add comment.
Diffstat (limited to 'mallocx.c')
-rw-r--r-- | mallocx.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -146,7 +146,11 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb) if (orig_sz > lb) { /* Clear unneeded part of object to avoid bogus pointer */ /* tracing. */ - BZERO(((ptr_t)p) + lb, orig_sz - lb); + word cleared_p = (word)p; + /* A workaround to avoid passing alloc_size(lb) */ + /* attribute associated with p to memset. */ + + BZERO((ptr_t)cleared_p + lb, orig_sz - lb); } return(p); } |