diff mbox series

[FFmpeg-devel,1/3] avcodec/h264_slice: fix undefined integer overflow with POC in error concealment

Message ID 20201008191915.18532-1-michael@niedermayer.cc
State Accepted
Commit 182d7a74276ea70aec6d3d7bd9a1da3d327358f2
Headers show
Series [FFmpeg-devel,1/3] avcodec/h264_slice: fix undefined integer overflow with POC in error concealment
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 8, 2020, 7:19 p.m. UTC
Alternatively the POC could be changed to 64bit. the large values seem to be within what is allowed.

Fixes: signed integer overflow: 2147483646 + 2 cannot be represented in type 'int'
Fixes: 26076/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711127201447936

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 Oct. 18, 2020, 7:29 p.m. UTC | #1
On Thu, Oct 08, 2020 at 09:19:13PM +0200, Michael Niedermayer wrote:
> Alternatively the POC could be changed to 64bit. the large values seem to be within what is allowed.
> 
> Fixes: signed integer overflow: 2147483646 + 2 cannot be represented in type 'int'
> Fixes: 26076/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711127201447936
> 
> 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

[...]
diff mbox series

Patch

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 74575bccd4..fa7a639053 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1606,7 +1606,7 @@  static int h264_field_start(H264Context *h, const H264SliceContext *sl,
                               prev->f->format,
                               prev->f->width,
                               prev->f->height);
-                h->short_ref[0]->poc = prev->poc + 2;
+                h->short_ref[0]->poc = prev->poc + 2U;
             } else if (!h->frame_recovered && !h->avctx->hwaccel)
                 ff_color_frame(h->short_ref[0]->f, c);
             h->short_ref[0]->frame_num = h->poc.prev_frame_num;