diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-07 18:45:25 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-07 18:52:43 +0400 |
commit | 7c425e4f2d677477e43cd5ce0d3a5348123b8c2f (patch) | |
tree | 0cf10f859078c4d6813c3465ebcf13c1ec61c1cf /libavcodec/h264_ps.c | |
parent | af164d7d9f12f9c2a4b284957eb92ad74cd49b3d (diff) | |
parent | d7d6efe42b0d2057e67999b96b9a391f533d2333 (diff) |
Merge commit 'd7d6efe42b0d2057e67999b96b9a391f533d2333'
* commit 'd7d6efe42b0d2057e67999b96b9a391f533d2333':
h264: check sps.log2_max_frame_num for validity
mov: validate number of DataReferenceBox entries against box size
mov: compute avg_frame_rate only if duration is known
flac: change minimum and default of lpc_passes option to 1
Conflicts:
libavcodec/h264_ps.c
libavformat/mov.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r-- | libavcodec/h264_ps.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 28d3cbc2c3..aef1ca6ba1 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -37,6 +37,9 @@ //#undef NDEBUG #include <assert.h> +#define MAX_LOG2_MAX_FRAME_NUM (12 + 4) +#define MIN_LOG2_MAX_FRAME_NUM 4 + static const AVRational pixel_aspect[17]={ {0, 1}, {1, 1}, @@ -331,7 +334,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ MpegEncContext * const s = &h->s; int profile_idc, level_idc, constraint_set_flags = 0; unsigned int sps_id; - int i; + int i, log2_max_frame_num_minus4; SPS *sps; profile_idc= get_bits(&s->gb, 8); @@ -394,12 +397,15 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ sps->bit_depth_chroma = 8; } - sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4; - if (sps->log2_max_frame_num < 4 || sps->log2_max_frame_num > 16) { - av_log(h->s.avctx, AV_LOG_ERROR, "illegal log2_max_frame_num %d\n", - sps->log2_max_frame_num); + log2_max_frame_num_minus4 = get_ue_golomb(&s->gb); + if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 || + log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) { + av_log(h->s.avctx, AV_LOG_ERROR, + "log2_max_frame_num_minus4 out of range (0-12): %d\n", + log2_max_frame_num_minus4); goto fail; } + sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4; sps->poc_type= get_ue_golomb_31(&s->gb); |