renderer: avoid out of bound sampler array access

Fix found thanks to american fuzzy lop.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
macos/master
Marc-André Lureau 9 years ago committed by Dave Airlie
parent 775f5ed62a
commit 18e4808c1d
  1. 6
      src/vrend_renderer.c

@ -3412,6 +3412,12 @@ void vrend_bind_sampler_states(struct vrend_context *ctx,
return;
}
if (num_states > PIPE_MAX_SAMPLERS ||
start_slot > (PIPE_MAX_SAMPLERS - num_states)) {
report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_CMD_BUFFER, num_states);
return;
}
ctx->sub->num_sampler_states[shader_type] = num_states;
for (i = 0; i < num_states; i++) {

Loading…
Cancel
Save