mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
fuzz: Fix FUZZ_malloc_rand() to return non-NULL for zero-size allocations
The FUZZ_malloc_rand() function was incorrectly always returning NULL for zero-size allocations. The random offset generated by FUZZ_dataProducer_int32Range() was not being added to the pointer variable, causing the function to always return (void *)0.
This commit is contained in:
@ -66,6 +66,7 @@ void* FUZZ_malloc(size_t size);
|
||||
/**
|
||||
* malloc except returns random pointer for zero sized data and FUZZ_ASSERT
|
||||
* that malloc doesn't fail.
|
||||
* WARNING: Only free the returned pointer if size > 0!
|
||||
*/
|
||||
void* FUZZ_malloc_rand(size_t size, FUZZ_dataProducer_t *producer);
|
||||
|
||||
|
Reference in New Issue
Block a user