[FFmpeg-devel,3/3] avcodec/h264_slice: Fix integer overflow in implicit_weight_table()

Submitted by Michael Niedermayer on Jan. 4, 2019, 7:22 p.m.

Details

Message ID 20190104192236.25585-3-michael@niedermayer.cc
State Accepted
Commit 77e56d74f972537aecd5bc2c5c4111e1d6ad0963
Headers show

Commit Message

Michael Niedermayer Jan. 4, 2019, 7:22 p.m.
Fixes: signed integer overflow: 2 * 2132811760 cannot be represented in type 'int'
Fixes: 11156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6237685933408256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/h264_slice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 12, 2019, 2:47 p.m.
On Fri, Jan 04, 2019 at 08:22:36PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2 * 2132811760 cannot be represented in type 'int'
> Fixes: 11156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6237685933408256
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/h264_slice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 2e158745a0..1c9a270fb6 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -678,7 +678,7 @@  static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in
             cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure - 1];
         }
         if (sl->ref_count[0] == 1 && sl->ref_count[1] == 1 && !FRAME_MBAFF(h) &&
-            sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2 * cur_poc) {
+            sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2LL * cur_poc) {
             sl->pwt.use_weight        = 0;
             sl->pwt.use_weight_chroma = 0;
             return;