Nishat Shabbir
unread,Jul 1, 2026, 2:42:00 AM (yesterday) Jul 1Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to codec...@webmproject.org
The VP9E_SET_SVC_LAYER_ID control copies the caller-supplied
vpx_svc_layer_id_t::temporal_layer_id_per_spatial[] values into the
encoder SVC state (svc->temporal_layer_id_per_spatial[]) without any
range checking, even though the scalar temporal_layer_id is validated
against ts_number_layers a few lines below.
In BYPASS temporal-layering mode with a ref-frame config set (via
VP9E_SET_SVC_REF_FRAME_CONFIG), set_flags_and_fb_idx_bypass_via_set_ref_frame_config()
copies temporal_layer_id_per_spatial[sl] into svc->temporal_layer_id,
which vp9_one_pass_svc_start_layer() then uses to index the fixed-size
svc->layer_context[VPX_MAX_LAYERS] array. An out-of-range value therefore
produces an out-of-bounds read/write during vpx_codec_encode().
Validate each per-spatial temporal id against ts_number_layers when the
control is set, returning VPX_CODEC_INVALID_PARAM, mirroring the existing
check on the scalar temporal_layer_id.
---
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index fc64343..7c1fb54 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -1918,6 +1918,14 @@ static vpx_codec_err_t ctrl_set_svc_layer_id(vpx_codec_alg_priv_t *ctx,
svc->temporal_layer_id = data->temporal_layer_id;
// Allow for setting temporal layer per spatial layer for superframe.
for (sl = 0; sl < cpi->svc.number_spatial_layers; ++sl) {
+ // Checks on valid temporal_layer_id_per_spatial input: it is used to index
+ // svc->layer_context[] in the encoder, so an out-of-range value results in
+ // an out-of-bounds access.
+ if (data->temporal_layer_id_per_spatial[sl] < 0 ||
+ data->temporal_layer_id_per_spatial[sl] >=
+ (int)ctx->cfg.ts_number_layers) {
+ return VPX_CODEC_INVALID_PARAM;
+ }
svc->temporal_layer_id_per_spatial[sl] =
data->temporal_layer_id_per_spatial[sl];
}
--
2.50.1 (Apple Git-155)