aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_ps.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-05-25 21:51:27 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-05-25 21:51:27 +0000
commitf4348e6cce6fa15d3240dfb5d84dd2b03f90367e (patch)
tree3a1db5e6507cf1ac37365d2436913589420269db /libavcodec/h264_ps.c
parent577ee94871b0062eeed34508ff2099704252fa19 (diff)
downloadffmpeg-f4348e6cce6fa15d3240dfb5d84dd2b03f90367e.tar.gz
Check for VUI overeading and reset num_reoder_frames.
This helps the video from issue1831 Originally committed as revision 23328 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r--libavcodec/h264_ps.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index e5ae403204..7648e2c7a6 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -205,6 +205,12 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
sps->num_reorder_frames= get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb); /*max_dec_frame_buffering*/
+ if(s->gb.size_in_bits < get_bits_count(&s->gb)){
+ av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", get_bits_count(&s->gb) - s->gb.size_in_bits);
+ sps->num_reorder_frames=0;
+ sps->bitstream_restriction_flag= 0;
+ }
+
if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
return -1;