aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2013-05-07 07:25:10 +0200
committerReinhard Tartler <siretart@tauware.de>2013-05-09 11:20:11 +0200
commit7d4c38d58d01832498302a5fc224880f1bd8b494 (patch)
tree3cb92890d695bcde8f71749626be3e1ce6724aa7
parent7e6625a9afbe247e5b5da1f1bc4071cb8ae83192 (diff)
downloadffmpeg-7d4c38d58d01832498302a5fc224880f1bd8b494.tar.gz
h264: check for luma and chroma bit depth being equal
The decoder assumes a single bit depth for all the planes while the specification allows different bit depths for luma and chroma. Avoid the possible problems described in CVE-2013-2277 Conflicts: libavcodec/h264.c
-rw-r--r--libavcodec/h264.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 739b9d2e51..ae2cf23a64 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3867,6 +3867,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
if(avctx->has_b_frames < 2)
avctx->has_b_frames= !s->low_delay;
+ if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
+ av_log_missing_feature(s->avctx,
+ "Different bit depth between chroma and luma", 1);
+ return AVERROR_PATCHWELCOME;
+ }
+
if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma) {
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
avctx->bits_per_raw_sample = h->sps.bit_depth_luma;