From the spec: "It is a requirement of bitstream conformance that the value of luma_bit_depth_entry_minus8 shall be equal to the value of bit_depth_luma_minus8"; similarly for chroma. Also fixes Coverity ticket #1529226 (complaining about the fact that chroma_bit_depth_entry is checked twice).
Unified · Split
| @@ -1581,11 +1581,13 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, · 1580 unmodified lines | ||
| 1581 | 1581 | } |
| 1582 | 1582 | pps->monochrome_palette_flag = get_bits1(gb); |
| 1583 | 1583 | pps->luma_bit_depth_entry = get_ue_golomb_31(gb) + 8; |
| 1584 | − if (!pps->monochrome_palette_flag) | |
| 1585 | − pps->chroma_bit_depth_entry = get_ue_golomb_31(gb) + 8; | |
| 1586 | − | |
| 1587 | − if (pps->chroma_bit_depth_entry > 16 || pps->chroma_bit_depth_entry > 16) | |
| 1584 | + if (pps->luma_bit_depth_entry != sps->bit_depth) | |
| 1588 | 1585 | return AVERROR_INVALIDDATA; |
| 1586 | + if (!pps->monochrome_palette_flag) { | |
| 1587 | + pps->chroma_bit_depth_entry = get_ue_golomb_31(gb) + 8; | |
| 1588 | + if (pps->chroma_bit_depth_entry != sps->bit_depth_chroma) | |
| 1589 | + return AVERROR_INVALIDDATA; | |
| 1590 | + } | |
| 1589 | 1591 | |
| 1590 | 1592 | num_comps = pps->monochrome_palette_flag ? 1 : 3; |
| 1591 | 1593 | for (int comp = 0; comp < num_comps; comp++) { |