diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-01-19 14:44:24 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-02-10 12:01:43 +1000 |
commit | 36492a4012f127c4d8d789f57d3959a2a65caa56 (patch) | |
tree | b052c9077b9e8ddc25fc6df703bb2d40c7b0a881 | |
parent | ad4f0f1941677c6cd78bcd14348cd99ae7dd7527 (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.c | 4 |
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; } |