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

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/hevc_ps.c+6−4
@@ -1581,11 +1581,13 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, · 1580 unmodified lines
15811581 }
15821582 pps->monochrome_palette_flag = get_bits1(gb);
15831583 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)
15881585 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+ }
15891591
15901592 num_comps = pps->monochrome_palette_flag ? 1 : 3;
15911593 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