File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,18 +37,25 @@ pub fn find_next<'a, F: Family>(
3737 let mut next_uncovered: Location < F > = range. start ;
3838
3939 // Create iterators for both data structures (already sorted)
40+ // `Location::checked_add` returns `None` on overflow *or* when the result
41+ // exceeds `Family::MAX_LEAVES`. The previous unconditional `.unwrap()`
42+ // panicked on fuzzer-generated inputs that placed `start_loc` near the
43+ // ceiling. Clamp such ranges to `range.end` instead — semantically the
44+ // batch is already at the boundary, so the merge logic terminates the
45+ // loop on the next iteration as expected (#2068).
46+ let range_end = range. end ;
4047 let mut fetched_ops_iter = fetched_operations
4148 . iter ( )
4249 . map ( |( & start_loc, & operation_count) | {
43- let end_loc = start_loc. checked_add ( operation_count) . unwrap ( ) ;
50+ let end_loc = start_loc. checked_add ( operation_count) . unwrap_or ( range_end ) ;
4451 start_loc..end_loc
4552 } )
4653 . peekable ( ) ;
4754
4855 let mut outstanding_reqs_iter = outstanding_requests
4956 . into_iter ( )
5057 . map ( |& start_loc| {
51- let end_loc = start_loc. checked_add ( fetch_batch_size. get ( ) ) . unwrap ( ) ;
58+ let end_loc = start_loc. checked_add ( fetch_batch_size. get ( ) ) . unwrap_or ( range_end ) ;
5259 start_loc..end_loc
5360 } )
5461 . peekable ( ) ;
You can’t perform that action at this time.
0 commit comments