Changeset
2b1cde7783 introduced "batch mode" to afl-harness, which allowed
the handling of several inputs in sequence.
Unfortunately, it introduced a file pointer leak when the file was
larger than the maximum size. Restructure the code to always close fp
if we opened it.
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
exit(-1);
}
- if ( !feof(fp) )
+ /* Only run the test if the input file was smaller than INPUT_SIZE */
+ if ( feof(fp) )
+ {
+ LLVMFuzzerTestOneInput(input, size);
+ }
+ else
{
printf("Input too large\n");
/* Don't exit if we're doing batch processing */
if ( max == 1 )
exit(-1);
- continue;
}
if ( fp != stdin )
fclose(fp);
fp = NULL;
}
-
- LLVMFuzzerTestOneInput(input, size);
}
return 0;