Skip to content

Commit

Permalink
Fix segfault for wrongly specified test on commandline. (#21)
Browse files Browse the repository at this point in the history
If explicitly specified test does not exist,
dieharder segfaults, for example
  dieharder -d 42
  dieharder -d 5000
  • Loading branch information
mbroz authored Feb 6, 2024
1 parent a186d90 commit c987a15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dieharder/run_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void run_test()
}
}
}
if(dtest_num >= 0){
if(dtest_num >= 0 && dtest_num < MAXTESTS && dh_test_types[dtest_num]){
execute_test(dtest_num);
} else {
fprintf(stderr,"Error: dtest_num = %d. No test found.\n",dtest_num);
Expand Down

0 comments on commit c987a15

Please sign in to comment.