[fuzz] Avoid empty memcpy and ubsan complain by length checking before memcpy
This commit is contained in:
parent
6543d166fd
commit
558f922788
@ -41,7 +41,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
unsigned int len = sizeof (text32);
|
unsigned int len = sizeof (text32);
|
||||||
if (size < len)
|
if (size < len)
|
||||||
len = size;
|
len = size;
|
||||||
memcpy(text32, data + size - len, len);
|
if (len)
|
||||||
|
memcpy(text32, data + size - len, len);
|
||||||
|
|
||||||
hb_buffer_t *buffer = hb_buffer_create ();
|
hb_buffer_t *buffer = hb_buffer_create ();
|
||||||
hb_buffer_add_utf32 (buffer, text32, sizeof (text32) / sizeof (text32[0]), 0, -1);
|
hb_buffer_add_utf32 (buffer, text32, sizeof (text32) / sizeof (text32[0]), 0, -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user