vrend: fix boundary check for SSBO state update
(PIPE_MAX_SHADER_BUFFERS - num_ssbo) can underflow.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index 35ccc23..9fc3552 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -1208,7 +1208,7 @@
return 0;
if (start_slot > PIPE_MAX_SHADER_BUFFERS ||
- start_slot > PIPE_MAX_SHADER_BUFFERS - num_ssbo)
+ num_ssbo > PIPE_MAX_SHADER_BUFFERS - start_slot)
return EINVAL;
for (uint32_t i = 0; i < num_ssbo; i++) {