mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-01 04:12:14 +00:00
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). Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
1c61c24f5f
commit
f6dc85ae16
@ -1581,11 +1581,13 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
|
||||
}
|
||||
pps->monochrome_palette_flag = get_bits1(gb);
|
||||
pps->luma_bit_depth_entry = get_ue_golomb_31(gb) + 8;
|
||||
if (!pps->monochrome_palette_flag)
|
||||
pps->chroma_bit_depth_entry = get_ue_golomb_31(gb) + 8;
|
||||
|
||||
if (pps->chroma_bit_depth_entry > 16 || pps->chroma_bit_depth_entry > 16)
|
||||
if (pps->luma_bit_depth_entry != sps->bit_depth)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!pps->monochrome_palette_flag) {
|
||||
pps->chroma_bit_depth_entry = get_ue_golomb_31(gb) + 8;
|
||||
if (pps->chroma_bit_depth_entry != sps->bit_depth_chroma)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
num_comps = pps->monochrome_palette_flag ? 1 : 3;
|
||||
for (int comp = 0; comp < num_comps; comp++) {
|
||||
|
Loading…
Reference in New Issue
Block a user