diff options
author | James Almer <jamrial@gmail.com> | 2023-04-13 10:19:57 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-04-14 10:04:47 -0300 |
commit | 7c6e26a18403376987541f1ca801ae225f8ee6d4 (patch) | |
tree | db0818413aa3aeaa0f0fca1bd4a72c921be33d23 /libavcodec/me_cmp.c | |
parent | 5cda6b94f45c347805cbd5a0c7ed1d712b5722d7 (diff) | |
download | ffmpeg-7c6e26a18403376987541f1ca801ae225f8ee6d4.tar.gz |
avcodec/mp_cmp: reject invalid comparison function values
Fixes tickets #10306 and #10318.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/me_cmp.c')
-rw-r--r-- | libavcodec/me_cmp.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c index e2f9f84b05..cd05e63ffd 100644 --- a/libavcodec/me_cmp.c +++ b/libavcodec/me_cmp.c @@ -473,8 +473,9 @@ static int zero_cmp(MpegEncContext *s, const uint8_t *a, const uint8_t *b, return 0; } -void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type) +int ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type) { + int ret = 0; int i; memset(cmp, 0, sizeof(void *) * 6); @@ -533,9 +534,13 @@ void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type) #endif default: av_log(NULL, AV_LOG_ERROR, - "internal error in cmp function selection\n"); + "invalid cmp function selection\n"); + ret = -1; + break; } } + + return ret; } #define BUTTERFLY2(o1, o2, i1, i2) \ |