mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
avcodec/h264_ps: Check offset_for_non_ref_pic, offset_for_top_to_bottom_field and offset_for_ref_frame
Fixes: signed integer overflow: -2147483648 + -1 cannot be represented in type 'int' Fixes: 14444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5675880333967360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
407e7c34ca
commit
7c6f2bfdb2
@ -451,6 +451,15 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
|
|||||||
sps->delta_pic_order_always_zero_flag = get_bits1(gb);
|
sps->delta_pic_order_always_zero_flag = get_bits1(gb);
|
||||||
sps->offset_for_non_ref_pic = get_se_golomb_long(gb);
|
sps->offset_for_non_ref_pic = get_se_golomb_long(gb);
|
||||||
sps->offset_for_top_to_bottom_field = get_se_golomb_long(gb);
|
sps->offset_for_top_to_bottom_field = get_se_golomb_long(gb);
|
||||||
|
|
||||||
|
if ( sps->offset_for_non_ref_pic == INT32_MIN
|
||||||
|
|| sps->offset_for_top_to_bottom_field == INT32_MIN
|
||||||
|
) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"offset_for_non_ref_pic or offset_for_top_to_bottom_field is out of range\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
sps->poc_cycle_length = get_ue_golomb(gb);
|
sps->poc_cycle_length = get_ue_golomb(gb);
|
||||||
|
|
||||||
if ((unsigned)sps->poc_cycle_length >=
|
if ((unsigned)sps->poc_cycle_length >=
|
||||||
@ -460,8 +469,14 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < sps->poc_cycle_length; i++)
|
for (i = 0; i < sps->poc_cycle_length; i++) {
|
||||||
sps->offset_for_ref_frame[i] = get_se_golomb_long(gb);
|
sps->offset_for_ref_frame[i] = get_se_golomb_long(gb);
|
||||||
|
if (sps->offset_for_ref_frame[i] == INT32_MIN) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"offset_for_ref_frame is out of range\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (sps->poc_type != 2) {
|
} else if (sps->poc_type != 2) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
|
av_log(avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user