Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-02-17 06:20:54 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-17 22:31:39 +0300
commit1be49cee34eb588d70c2bf4c46dc23539fd71b53 (patch)
tree88f6cccdf660923587352d26620d1c9795f42018 /libavcodec/h264_parse.c
parent01370b31aced784593f2bc0836f4ba6fd8e7f6b3 (diff)
avcodec/h264: Increase field_poc to 64bit in ff_h264_init_poc() to detect overflows
Fixes: Integer overflow Fixes: 5746/clusterfuzz-testcase-minimized-6270097623613440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_parse.c')
-rw-r--r--libavcodec/h264_parse.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index fee28d90d9..6cbef5a13d 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -271,7 +271,7 @@ int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc,
int picture_structure, int nal_ref_idc)
{
const int max_frame_num = 1 << sps->log2_max_frame_num;
- int field_poc[2];
+ int64_t field_poc[2];
pc->frame_num_offset = pc->prev_frame_num_offset;
if (pc->frame_num < pc->prev_frame_num)
@@ -337,6 +337,10 @@ int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc,
field_poc[1] = poc;
}
+ if ( field_poc[0] != (int)field_poc[0]
+ || field_poc[1] != (int)field_poc[1])
+ return AVERROR_INVALIDDATA;
+
if (picture_structure != PICT_BOTTOM_FIELD)
pic_field_poc[0] = field_poc[0];
if (picture_structure != PICT_TOP_FIELD)