Commit 9ecabd78 authored by Anton Khirnov's avatar Anton Khirnov

h264: reset num_reorder_frames if it is invalid

An invalid VUI is not considered a fatal error, so the SPS containing it
may still be used. Leaving an invalid value of num_reorder_frames there
can result in writing over the bounds of H264Context.delayed_pic.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
parent 0652e024
...@@ -224,7 +224,9 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps) ...@@ -224,7 +224,9 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
if (sps->num_reorder_frames > 16U if (sps->num_reorder_frames > 16U
/* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) { /* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"illegal num_reorder_frames %d\n", sps->num_reorder_frames); "Clipping illegal num_reorder_frames %d\n",
sps->num_reorder_frames);
sps->num_reorder_frames = 16;
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment