Commit 4987faee authored by Luca Barbato's avatar Luca Barbato

h264: check for luma and chroma bit dept 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

parent c57a5936
......@@ -2745,6 +2745,12 @@ static int h264_set_parameter_from_sps(H264Context *h)
if (h->avctx->has_b_frames < 2)
h->avctx->has_b_frames = !h->low_delay;
if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
"Different bit depth between chroma and luma", 1);
if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (h->avctx->codec &&
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