Skip to content

Commit be47ac3

Browse files
authored
Fuzzing function generator: bound the debug-labels size. (#73)
Currently there is a loop that takes a variable step toward an end point with an integer from `Arbitrary`; if this integer is always zero (for example due to end-of-input?) then we add debug labels to a particular input SSA value forever. This eventually causes an OOM crash. This PR bounds the loop at a reasonable count (10) instead.
1 parent ad39c66 commit be47ac3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/fuzzing/func.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,10 @@ impl Func {
388388
if bool::arbitrary(u)? {
389389
let assumed_end_inst = 10 * num_blocks;
390390
let mut start = u.int_in_range::<usize>(0..=assumed_end_inst)?;
391-
while start < assumed_end_inst {
391+
for _ in 0..10 {
392+
if start >= assumed_end_inst {
393+
break;
394+
}
392395
let end = u.int_in_range::<usize>(start..=assumed_end_inst)?;
393396
let label = u.int_in_range::<u32>(0..=100)?;
394397
builder.f.debug_value_labels.push((

0 commit comments

Comments
 (0)