summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-01-19 14:44:24 +0100
committerDave Airlie <airlied@redhat.com>2016-02-10 12:01:43 +1000
commit36492a4012f127c4d8d789f57d3959a2a65caa56 (patch)
treeb052c9077b9e8ddc25fc6df703bb2d40c7b0a881
parentad4f0f1941677c6cd78bcd14348cd99ae7dd7527 (diff)
decode: validate shader type
Fix found thanks to american fuzzy lop. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r--src/vrend_decode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index be5777e..a5467e3 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -219,6 +219,10 @@ static int vrend_decode_set_constant_buffer(struct vrend_decode_ctx *ctx, uint16
shader = get_buf_entry(ctx, VIRGL_SET_CONSTANT_BUFFER_SHADER_TYPE);
index = get_buf_entry(ctx, VIRGL_SET_CONSTANT_BUFFER_INDEX);
+
+ if (shader >= PIPE_SHADER_TYPES)
+ return EINVAL;
+
vrend_set_constants(ctx->grctx, shader, index, nc, get_buf_ptr(ctx, VIRGL_SET_CONSTANT_BUFFER_DATA_START));
return 0;
}