mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
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));
|
check_error(mpv_command(ctx, cmd));
|
||||||
|
|
||||||
#ifdef MPV_LOADFILE
|
#ifdef MPV_LOADFILE
|
||||||
|
bool loaded = false;
|
||||||
while (1) {
|
while (1) {
|
||||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
mpv_event *event = mpv_wait_event(ctx, -1);
|
||||||
if (event->event_id == MPV_EVENT_IDLE)
|
if (event->event_id == MPV_EVENT_START_FILE)
|
||||||
|
loaded = true;
|
||||||
|
if (loaded && event->event_id == MPV_EVENT_IDLE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,9 +75,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
const char *cmd[] = {"loadfile", data, NULL};
|
const char *cmd[] = {"loadfile", data, NULL};
|
||||||
check_error(mpv_command(ctx, cmd));
|
check_error(mpv_command(ctx, cmd));
|
||||||
|
|
||||||
|
bool loaded = false;
|
||||||
while (1) {
|
while (1) {
|
||||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
mpv_event *event = mpv_wait_event(ctx, -1);
|
||||||
if (event->event_id == MPV_EVENT_IDLE)
|
if (event->event_id == MPV_EVENT_START_FILE)
|
||||||
|
loaded = true;
|
||||||
|
if (loaded && event->event_id == MPV_EVENT_IDLE)
|
||||||
break;
|
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};
|
const char *cmd[] = {"loadfile", "av://lavfi:yuvtestsrc=d=0.01", NULL};
|
||||||
check_error(mpv_command(ctx, cmd));
|
check_error(mpv_command(ctx, cmd));
|
||||||
|
|
||||||
|
bool loaded = false;
|
||||||
while (1) {
|
while (1) {
|
||||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
mpv_event *event = mpv_wait_event(ctx, -1);
|
||||||
if (event->event_id == MPV_EVENT_IDLE)
|
if (event->event_id == MPV_EVENT_START_FILE)
|
||||||
|
loaded = true;
|
||||||
|
if (loaded && event->event_id == MPV_EVENT_IDLE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user