History

avcodec/hevc/ps: add a range check for sps_max_sub_layers

It can't be higher than vps_max_sub_layers. Do this while keeping the workaround for qsvenc_hevc calling ff_hevc_parse_sps() without a vps_list, as in some cases it needs to parse an sps to generate a fake vps derived from it.

James Almer committed 2 years ago

Commit bd628331 parent 32906921 file · +5 −1Browse files

Unified · Split

libavcodec/hevc/ps.c+5−1
@@ -1158,6 +1158,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, · 1157 unmodified lines
11581158 HEVCWindow *ow;
11591159 int ret = 0;
11601160 int bit_depth_chroma, num_comps, multi_layer_ext;
1161+ int vps_max_sub_layers;
11611162 int i;
11621163
11631164 // Coded parameters
@@ -1182,7 +1183,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, · 18 unmodified lines
11821183
11831184 sps->max_sub_layers = sps->vps->vps_max_sub_layers;
11841185 }
1185− if (sps->max_sub_layers > HEVC_MAX_SUB_LAYERS) {
1186+ vps_max_sub_layers = sps->vps ? sps->vps->vps_max_sub_layers
1187+ : FFMIN(sps->max_sub_layers, HEVC_MAX_SUB_LAYERS);
1188+
1189+ if (sps->max_sub_layers > vps_max_sub_layers) {
11861190 av_log(avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n",
11871191 sps->max_sub_layers);
11881192 return AVERROR_INVALIDDATA;

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