Skip to content

Commit a5f7814

Browse files
committed
Limit input length in encoding parsing fuzz target
1 parent aa67e05 commit a5f7814

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/test-fuzz/fuzz_targets/encoding_parse.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ use libfuzzer_sys::fuzz_target;
55
use objc2::encode::{Encoding, EncodingBox};
66

77
fuzz_target!(|s: &str| {
8+
// Limit string length to < 1024 so that we don't hit stack overflows
9+
if s.len() > 1024 {
10+
return;
11+
}
812
// Check that parsing encodings doesn't panic
913
if let Ok(enc) = EncodingBox::from_str(s) {
1014
// Check a "negative" case of `equivalent_to_box`

0 commit comments

Comments
 (0)