diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-10 14:41:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-14 12:20:16 +0200 |
commit | 25a592e5d45672bdfdac35bf0119907cdcddd1b7 (patch) | |
tree | dff9c81873e00db5fe63359c0e0b6b1dc74a16e9 | |
parent | 3c8e14482e3f167c1803a4e03883a33f677e9520 (diff) | |
download | ffmpeg-25a592e5d45672bdfdac35bf0119907cdcddd1b7.tar.gz |
avcodec/cavs: Check updated MV
Fixes: runtime error: signed integer overflow: 251 + 2147483647 cannot be represented in type 'int'
Fixes: 1438/clusterfuzz-testcase-minimized-4917542646710272
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5871adc90f8c1037535563e33ebeaf032bb4d5d6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/cavs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 10e118e55b..8542b124ef 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -613,8 +613,15 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, mv_pred_median(h, mvP, mvA, mvB, mvC); if (mode < MV_PRED_PSKIP) { - mvP->x += get_se_golomb(&h->gb); - mvP->y += get_se_golomb(&h->gb); + int mx = get_se_golomb(&h->gb) + (unsigned)mvP->x; + int my = get_se_golomb(&h->gb) + (unsigned)mvP->y; + + if (mx != (int16_t)mx || my != (int16_t)my) { + av_log(h->avctx, AV_LOG_ERROR, "MV %d %d out of supported range\n", mx, my); + } else { + mvP->x = mx; + mvP->y = my; + } } set_mvs(mvP, size); } |