mirror of https://github.com/mpv-player/mpv
fuzzers: wait for file start event before idle
Sometimes we exited too soon, not waiting for full transition to idle state.
This commit is contained in:
parent
995283bd7a
commit
4574644b7a
|
@ -81,9 +81,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||
check_error(mpv_command(ctx, cmd));
|
||||
|
||||
#ifdef MPV_LOADFILE
|
||||
bool loaded = false;
|
||||
while (1) {
|
||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
||||
if (event->event_id == MPV_EVENT_IDLE)
|
||||
mpv_event *event = mpv_wait_event(ctx, -1);
|
||||
if (event->event_id == MPV_EVENT_START_FILE)
|
||||
loaded = true;
|
||||
if (loaded && event->event_id == MPV_EVENT_IDLE)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -75,9 +75,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||
const char *cmd[] = {"loadfile", data, NULL};
|
||||
check_error(mpv_command(ctx, cmd));
|
||||
|
||||
bool loaded = false;
|
||||
while (1) {
|
||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
||||
if (event->event_id == MPV_EVENT_IDLE)
|
||||
mpv_event *event = mpv_wait_event(ctx, -1);
|
||||
if (event->event_id == MPV_EVENT_START_FILE)
|
||||
loaded = true;
|
||||
if (loaded && event->event_id == MPV_EVENT_IDLE)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,9 +104,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||
const char *cmd[] = {"loadfile", "av://lavfi:yuvtestsrc=d=0.01", NULL};
|
||||
check_error(mpv_command(ctx, cmd));
|
||||
|
||||
bool loaded = false;
|
||||
while (1) {
|
||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
||||
if (event->event_id == MPV_EVENT_IDLE)
|
||||
mpv_event *event = mpv_wait_event(ctx, -1);
|
||||
if (event->event_id == MPV_EVENT_START_FILE)
|
||||
loaded = true;
|
||||
if (loaded && event->event_id == MPV_EVENT_IDLE)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue