File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -217,8 +217,12 @@ quickcheck_limit! {
217
217
} )
218
218
}
219
219
220
- fn swap_indices( vec: Vec <u8 >, a: usize , b: usize ) -> TestResult {
220
+ // Use `u8` test indices so quickcheck is likely to go out of bounds.
221
+ fn swap_indices( vec: Vec <u8 >, a: u8 , b: u8 ) -> TestResult {
221
222
let mut set = IndexSet :: <u8 >:: from_iter( vec) ;
223
+ let a = usize :: from( a) ;
224
+ let b = usize :: from( b) ;
225
+
222
226
if a >= set. len( ) || b >= set. len( ) {
223
227
return TestResult :: discard( ) ;
224
228
}
@@ -236,8 +240,12 @@ quickcheck_limit! {
236
240
TestResult :: passed( )
237
241
}
238
242
239
- fn move_index( vec: Vec <u8 >, from: usize , to: usize ) -> TestResult {
243
+ // Use `u8` test indices so quickcheck is likely to go out of bounds.
244
+ fn move_index( vec: Vec <u8 >, from: u8 , to: u8 ) -> TestResult {
240
245
let mut set = IndexSet :: <u8 >:: from_iter( vec) ;
246
+ let from = usize :: from( from) ;
247
+ let to = usize :: from( to) ;
248
+
241
249
if from >= set. len( ) || to >= set. len( ) {
242
250
return TestResult :: discard( ) ;
243
251
}
You can’t perform that action at this time.
0 commit comments