fuzz: Add a test case for `ParseByteUnits()`
What changed, and why it matters
This commit only adds a new fuzz test for an existing string-parsing helper called ParseByteUnits(). It does not change any production code, fix a bug, or alter behavior. Fuzz tests feed random inputs to functions to help find crashes or bugs during automated testing, but the function itself is unchanged.
No security action needed; this is a test-only addition. Continue normal review and fuzzing pipeline monitoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a fuzz-target block in src/test/fuzz/string.cpp that exercises ParseByteUnits(random_string_1, default_multiplier) with a randomized ByteUnit default_multiplier. No implementation code in strencodings.cpp or elsewhere is modified. There is no patch to a vulnerability.
Changed components
src/test/fuzz/string.cppInspect captured patch +15 / −0
diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp
index 443d7241..5d59eb34 100644
--- a/src/test/fuzz/string.cpp
+++ b/src/test/fuzz/string.cpp
@@ -147,4 +147,19 @@ FUZZ_TARGET(string)
const bilingual_str bs2{random_string_2, random_string_1};
(void)(bs1 + bs2);
}
+ {
+ const ByteUnit all_units[] = {
+ ByteUnit::NOOP,
+ ByteUnit::k,
+ ByteUnit::K,
+ ByteUnit::m,
+ ByteUnit::M,
+ ByteUnit::g,
+ ByteUnit::G,
+ ByteUnit::t,
+ ByteUnit::T
+ };
+ ByteUnit default_multiplier = fuzzed_data_provider.PickValueInArray(all_units);
+ (void)ParseByteUnits(random_string_1, default_multiplier);
+ }
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.