aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-08 22:18:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-25 15:06:54 +0200
commitcf80856cbc790c8dc1b743bd5bdd1093a08467ca (patch)
treef91f2f5a9d677755790153155588254f3330b37e
parent9c4b09c4bdfa6dde530b9cae13bc9d76698228d1 (diff)
downloadffmpeg-cf80856cbc790c8dc1b743bd5bdd1093a08467ca.tar.gz
avcodec/h264_ps: Move truncation check from VUI to SPS
This more completely checks for truncation Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 32e06c485be94a4967bff87022cbb065d3cbfd0d) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/h264_ps.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 641e72dc58..d969aa1e3e 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -261,12 +261,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
}
}
- if (get_bits_left(&h->gb) < 0) {
- av_log(h->avctx, AV_LOG_ERROR,
- "Overread VUI by %d bits\n", -get_bits_left(&h->gb));
- return AVERROR_INVALIDDATA;
- }
-
return 0;
}
@@ -543,6 +537,12 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
goto fail;
}
+ if (get_bits_left(&h->gb) < 0) {
+ av_log(h->avctx, AV_LOG_ERROR,
+ "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(&h->gb));
+ goto fail;
+ }
+
if (!sps->sar.den)
sps->sar.den = 1;