diff options
author | Michael Niedermayer | 2015-04-16 01:59:19 +0200 |
---|---|---|
committer | Michael Niedermayer | 2015-04-16 03:41:41 +0200 |
commit | c658269cd18cd9861c805ca283857e17d2222d8d (patch) | |
tree | 10f55e1af1f6052c0730d863dd365a7d78ae98c0 /libavcodec/h264_ps.c | |
parent | 7498f2221ef21335db296e091467418363d1e88f (diff) |
avcodec/h264_ps: Validate num_units_in_tick/time_scale before setting them in the context
This probably makes no big difference but it is more correct
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r-- | libavcodec/h264_ps.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 3c8918115a..0d384dda22 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -191,13 +191,16 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps) sps->timing_info_present_flag = get_bits1(&h->gb); if (sps->timing_info_present_flag) { - sps->num_units_in_tick = get_bits_long(&h->gb, 32); - sps->time_scale = get_bits_long(&h->gb, 32); - if (!sps->num_units_in_tick || !sps->time_scale) { + unsigned num_units_in_tick = get_bits_long(&h->gb, 32); + unsigned time_scale = get_bits_long(&h->gb, 32); + if (!num_units_in_tick || !time_scale) { av_log(h->avctx, AV_LOG_ERROR, - "time_scale/num_units_in_tick invalid or unsupported (%"PRIu32"/%"PRIu32")\n", - sps->time_scale, sps->num_units_in_tick); + "time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n", + time_scale, num_units_in_tick); sps->timing_info_present_flag = 0; + } else { + sps->num_units_in_tick = num_units_in_tick; + sps->time_scale = time_scale; } sps->fixed_frame_rate_flag = get_bits1(&h->gb); } |