renderer: validate num_so_outputs

Avoid out-of-bound acces of array so_info.output.

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 3767dbf18c
commit 9033b26976
  1. 3
      src/vrend_decode.c

@ -80,6 +80,9 @@ static int vrend_decode_create_shader(struct vrend_decode_ctx *ctx,
offlen = get_buf_entry(ctx, VIRGL_OBJ_SHADER_OFFSET); offlen = get_buf_entry(ctx, VIRGL_OBJ_SHADER_OFFSET);
num_so_outputs = get_buf_entry(ctx, VIRGL_OBJ_SHADER_SO_NUM_OUTPUTS); num_so_outputs = get_buf_entry(ctx, VIRGL_OBJ_SHADER_SO_NUM_OUTPUTS);
if (num_so_outputs > PIPE_MAX_SO_OUTPUTS)
return EINVAL;
shader_offset = 6; shader_offset = 6;
if (num_so_outputs) { if (num_so_outputs) {
so_info.num_outputs = num_so_outputs; so_info.num_outputs = num_so_outputs;

Loading…
Cancel
Save