diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-11-18 23:30:42 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-11-18 23:55:28 +0000 |
commit | 4449f38c17766a4645fda12dc0f56a79f0ae2bce (patch) | |
tree | 2362f8cfdbf5391a662734aaf9b6283dce73388d /filters | |
parent | 9456b2f6e96fbf950324f5d7ad458f504644bb41 (diff) | |
download | mpv-4449f38c17766a4645fda12dc0f56a79f0ae2bce.tar.bz2 mpv-4449f38c17766a4645fda12dc0f56a79f0ae2bce.tar.xz |
various: add some missing error checks
Diffstat (limited to 'filters')
-rw-r--r-- | filters/f_autoconvert.c | 3 | ||||
-rw-r--r-- | filters/f_decoder_wrapper.c | 8 | ||||
-rw-r--r-- | filters/f_swresample.c | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/filters/f_autoconvert.c b/filters/f_autoconvert.c index 7f5c054d6f..dcd5ea2485 100644 --- a/filters/f_autoconvert.c +++ b/filters/f_autoconvert.c @@ -165,6 +165,9 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log, } struct mp_filter *conv = mp_filter_create(f, &convert_filter); + if (!conv) + return false; + mp_filter_add_pin(conv, MP_PIN_IN, "in"); mp_filter_add_pin(conv, MP_PIN_OUT, "out"); diff --git a/filters/f_decoder_wrapper.c b/filters/f_decoder_wrapper.c index 87489ccdf1..76b97078f5 100644 --- a/filters/f_decoder_wrapper.c +++ b/filters/f_decoder_wrapper.c @@ -430,10 +430,12 @@ static bool reinit_decoder(struct priv *p) } } + if (!driver) + return false; + if (!list) { struct mp_decoder_list *full = talloc_zero(NULL, struct mp_decoder_list); - if (driver) - driver->add_decoders(full); + driver->add_decoders(full); const char *codec = p->codec->codec; if (codec && strcmp(codec, "null") == 0) codec = fallback; @@ -1232,6 +1234,8 @@ struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent, p->decf = mp_filter_create(p->dec_root_filter ? p->dec_root_filter : public_f, &decf_filter); + if (!p->decf) + goto error; p->decf->priv = p; p->decf->log = public_f->log = p->log; mp_filter_add_pin(p->decf, MP_PIN_OUT, "out"); diff --git a/filters/f_swresample.c b/filters/f_swresample.c index fb1ef05194..8cb687def0 100644 --- a/filters/f_swresample.c +++ b/filters/f_swresample.c @@ -334,6 +334,8 @@ static bool reorder_planes(struct mp_aframe *mpa, int *reorder, int num_planes = mp_aframe_get_planes(mpa); uint8_t **planes = mp_aframe_get_data_rw(mpa); + if (num_planes && !planes) + return false; uint8_t *old_planes[MP_NUM_CHANNELS]; assert(num_planes <= MP_NUM_CHANNELS); for (int n = 0; n < num_planes; n++) |