aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-03-10 02:50:52 +0100
committerLuca Barbato <lu_zero@gentoo.org>2013-03-12 20:05:39 +0100
commit9e48d77158dcb104fb35b90593ace0b248bda7e1 (patch)
tree066a3f41646dbe5e6051c49ec53c2ce089a962e1
parentb9ec4414b5ee4128a58f863fa290ca14bfb39db6 (diff)
downloadffmpeg-9e48d77158dcb104fb35b90593ace0b248bda7e1.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
-rw-r--r--libavcodec/h264.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f3a47fe8c0..da865c6387 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4055,6 +4055,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 ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {