amd/vpelib: check stream_count as well before accessing streams

[WHY]
It was found that the caller may call with stream_count = 0, while
streams array is some garbage.
it randomly ends up output_ctx being modified and leading to validation
failure.

[HOW]
Add checking to the stream_count.

Acked-by: Chuanyu Tseng <Chuanyu.Tseng@amd.com>
Signed-off-by: Roy Chan <Roy.Chan@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36809>
This commit is contained in:
Chan, Roy
2025-08-11 21:08:52 -04:00
committed by ChuanYu Tseng (Max)
parent 2b50600a71
commit dda6a76b54
+2 -2
View File
@@ -38,7 +38,8 @@
void vpe_geometric_scaling_feature_skip(
struct vpe_priv *vpe_priv, const struct vpe_build_param *param)
{
if (param->streams && param->streams->flags.geometric_scaling) {
if ((param->num_streams > 0) && (param->streams != NULL) &&
(param->streams->flags.geometric_scaling != 0)) {
/* copy input cs to output for skiping gamut and gamma conversion */
vpe_priv->output_ctx.surface.cs.primaries = param->streams[0].surface_info.cs.primaries;
vpe_priv->output_ctx.surface.cs.tf = param->streams[0].surface_info.cs.tf;
@@ -52,7 +53,6 @@ void vpe_geometric_scaling_feature_skip(
/* disable blending */
vpe_priv->stream_ctx[0].stream.blend_info.blending = false;
}
}
/*