diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-03-10 17:24:52 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-03-14 04:23:50 +0300 |
commit | a557ae8d52ce1cfaf3be5cdb13728b7b2b9512b9 (patch) | |
tree | 6d7ad2bc0693adbeed63e257e6d98c3b3403b437 | |
parent | fbfbd97be25c4da0562ef61e2f27192d1ec4d276 (diff) |
avcodec/h264_direct: Fix runtime error: signed integer overflow: 2147483647 - -14133 cannot be represented in type 'int'
Fixes: 755/clusterfuzz-testcase-5369072516595712
See: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_direct: Fix runtime error: signed integer overflow: 2147483647 - -14133 cannot be represented in type 'int'
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/h264_direct.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c index cbb84665b3..66e54479d1 100644 --- a/libavcodec/h264_direct.c +++ b/libavcodec/h264_direct.c @@ -39,7 +39,12 @@ static int get_scale_factor(H264SliceContext *sl, int poc, int poc1, int i) { int poc0 = sl->ref_list[0][i].poc; - int td = av_clip_int8(poc1 - poc0); + int64_t pocdiff = poc1 - (int64_t)poc0; + int td = av_clip_int8(pocdiff); + + if (pocdiff != (int)pocdiff) + avpriv_request_sample(sl->h264->avctx, "pocdiff overflow\n"); + if (td == 0 || sl->ref_list[0][i].parent->long_ref) { return 256; } else { |