diff options
author | James Almer <jamrial@gmail.com> | 2023-04-13 10:19:57 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-04-16 11:38:26 -0300 |
commit | 2c111647072af2f481c43ce923b13201c969745c (patch) | |
tree | c074faf7f4fe562d601a8ed98c9e8d94ac74341e /libavcodec/snowenc.c | |
parent | 5606d270067c2cf0a0bc9646758fa48231a8b209 (diff) | |
download | ffmpeg-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/snowenc.c')
-rw-r--r-- | libavcodec/snowenc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 658684c575..f61c2c9b13 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -129,8 +129,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if (ret) return ret; - ff_set_cmp(&s->mecc, s->mecc.me_cmp, s->avctx->me_cmp); - ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, s->avctx->me_sub_cmp); + ret = ff_set_cmp(&s->mecc, s->mecc.me_cmp, s->avctx->me_cmp); + ret |= ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, s->avctx->me_sub_cmp); + if (ret < 0) + return AVERROR(EINVAL); s->input_picture = av_frame_alloc(); if (!s->input_picture) |