History

avcodec/hevc_ps: Improve PPS SCC extension bit depth check

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).

Andreas Rheinhardt committed 3 years ago

Commit f6dc85a1 parent 1c61c241 file · +6 −4Browse files

Unified · Split

libavcodec/hevc_ps.c+6−4
@@ -1581,11 +1581,13 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, · 1580 unmodified lines
1581 }1581 }
1582 pps->monochrome_palette_flag = get_bits1(gb);1582 pps->monochrome_palette_flag = get_bits1(gb);
1583 pps->luma_bit_depth_entry = get_ue_golomb_31(gb) + 8;1583 pps->luma_bit_depth_entry = get_ue_golomb_31(gb) + 8;
1584 if (!pps->monochrome_palette_flag)1584 if (pps->luma_bit_depth_entry != sps->bit_depth)
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)
1588 return AVERROR_INVALIDDATA;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 num_comps = pps->monochrome_palette_flag ? 1 : 3;1592 num_comps = pps->monochrome_palette_flag ? 1 : 3;
1591 for (int comp = 0; comp < num_comps; comp++) {1593 for (int comp = 0; comp < num_comps; comp++) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t