summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-10 18:35:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-10 18:35:07 +0200
commitbc48c88918f767e0dffcd138ae8e5c3052e8a92f (patch)
treec2245483d88419bfb0c36cdd729dd5e5ab1266a2 /libavcodec/h264.c
parent4d0f6d3fb421b3ab774ccd3c299f0a242f359a75 (diff)
avcodec/h264: Do not fail with randomly truncated VUIs
Fixes Ticket4445 Tested-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 2e286231b0..a8ffdde978 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1634,7 +1634,9 @@ again:
break;
case NAL_SPS:
init_get_bits(&h->gb, ptr, bit_length);
- if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? nalsize : 1)) {
+ if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
+ break;
+ if (h->is_avc ? nalsize : 1) {
av_log(h->avctx, AV_LOG_DEBUG,
"SPS decoding failure, trying again with the complete NAL\n");
if (h->is_avc)
@@ -1643,8 +1645,11 @@ again:
break;
init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
8*(next_avc - buf_index + consumed - 1));
- ff_h264_decode_seq_parameter_set(h);
+ if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
+ break;
}
+ init_get_bits(&h->gb, ptr, bit_length);
+ ff_h264_decode_seq_parameter_set(h, 1);
break;
case NAL_PPS: