[libc] Fix issue with fuzz input too short for atoi diff fuzz (#161705)
The string to integer differential fuzzer assumes at least one byte of meaningful input, but wasn't explicitly checking that. Now it does.
This commit is contained in:
parent
6bfa56a29a
commit
c4709823bb
@ -44,6 +44,10 @@
|
||||
// greater than 50% chance for each character to end the string, making the odds
|
||||
// of getting long numbers very low.
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
if (size < 2) // Needs at least one byte for the base and one byte for the
|
||||
// string.
|
||||
return 0;
|
||||
|
||||
uint8_t *container = new uint8_t[size + 1];
|
||||
if (!container)
|
||||
__builtin_trap();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user