aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dvenc.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-04-13 10:19:57 -0300
committerJames Almer <jamrial@gmail.com>2023-04-16 11:38:26 -0300
commit2c111647072af2f481c43ce923b13201c969745c (patch)
treec074faf7f4fe562d601a8ed98c9e8d94ac74341e /libavcodec/dvenc.c
parent5606d270067c2cf0a0bc9646758fa48231a8b209 (diff)
downloadffmpeg-2c111647072af2f481c43ce923b13201c969745c.tar.gz
avcodec/mp_cmp: reject invalid comparison function values
Fixes tickets #10306 and #10318. Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 7c6e26a18403376987541f1ca801ae225f8ee6d4)
Diffstat (limited to 'libavcodec/dvenc.c')
-rw-r--r--libavcodec/dvenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 11dd5763af..cd442b524d 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -104,7 +104,9 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
ff_fdctdsp_init(&fdsp, avctx);
ff_me_cmp_init(&mecc, avctx);
ff_pixblockdsp_init(&pdsp, avctx);
- ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp);
+ ret = ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp);
+ if (ret < 0)
+ return AVERROR(EINVAL);
s->get_pixels = pdsp.get_pixels;
s->ildct_cmp = mecc.ildct_cmp[5];