summaryrefslogtreecommitdiff
path: root/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
diff options
context:
space:
mode:
authorOliver Hunt <oliver@apple.com>2025-10-20 01:38:07 -0700
committerGitHub <noreply@github.com>2025-10-20 01:38:07 -0700
commit7de01aa5d0418bd4e8db2917f831e7383c6863bb (patch)
tree1db866f57c2236573cd4b4c2d141d6d420f87a92 /libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
parent6bc540043d4c3fed8f44c8f6de86be0d1740582e (diff)
parent46a866ab7735aaa0f89fde209d516271c4825c49 (diff)
Merge branch 'main' into users/ojhunt/ptrauth-additionsusers/ojhunt/ptrauth-additions
Diffstat (limited to 'libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp')
-rw-r--r--libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp b/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
index 097e6193ee6e..2fabbba23116 100644
--- a/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
+++ b/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp
@@ -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();