ref: 763d246e51be73ff6c45c0d8355ba3a7a6476e26
parent: 1d09620b958136aae59aca8aba98c2e8c9f7ecd2
author: lieff <[email protected]>
date: Tue Feb 27 08:48:15 EST 2018
fuzz: better stability
--- a/fuzzing/fuzz.c
+++ b/fuzzing/fuzz.c
@@ -6,24 +6,23 @@
{
static mp3dec_t mp3d;
mp3dec_frame_info_t info;
- int nbuf = 0;
unsigned char buf[4096];
- mp3dec_init(&mp3d);
-
#ifdef __AFL_HAVE_MANUAL_CONTROL
- __AFL_INIT();
+ __AFL_INIT();
while (__AFL_LOOP(1000))
#endif
- {
- do
- {
- short pcm[MINIMP3_MAX_SAMPLES_PER_FRAME];
- nbuf += fread(buf + nbuf, 1, sizeof(buf) - nbuf, stdin);
- mp3dec_decode_frame(&mp3d, buf, nbuf, pcm, &info);
- nbuf -= info.frame_bytes;
- } while (info.frame_bytes);
- }
+ {
+ int nbuf = 0;
+ mp3dec_init(&mp3d);
+ do
+ {
+ short pcm[MINIMP3_MAX_SAMPLES_PER_FRAME];
+ nbuf += fread(buf + nbuf, 1, sizeof(buf) - nbuf, stdin);
+ mp3dec_decode_frame(&mp3d, buf, nbuf, pcm, &info);
+ nbuf -= info.frame_bytes;
+ } while (info.frame_bytes);
+ }
return 0;
}