player/playloop: fix null dereference if filter_root does not exist

For example when `input-commands=drop-buffers` is added to the config.

Add a check inside mp_filter_reset().

Found by OSS-Fuzz.
This commit is contained in:
Kacper Michajłow 2024-06-24 14:45:13 +02:00 committed by sfan5
parent 82ffe8f425
commit 893ea5e47b
2 changed files with 4 additions and 2 deletions

View File

@ -1114,8 +1114,7 @@ static void public_f_reset(struct mp_filter *f)
if (p->queue) {
mp_async_queue_reset(p->queue);
thread_lock(p);
if (p->dec_root_filter)
mp_filter_reset(p->dec_root_filter);
mp_filter_reset(p->dec_root_filter);
mp_dispatch_interrupt(p->dec_dispatch);
thread_unlock(p);
mp_async_queue_resume(p->queue);

View File

@ -592,6 +592,9 @@ static void reset_pin(struct mp_pin *p)
void mp_filter_reset(struct mp_filter *filter)
{
if (!filter)
return;
for (int n = 0; n < filter->in->num_children; n++)
mp_filter_reset(filter->in->children[n]);