summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-01-18 23:05:31 +0100
committerDave Airlie <airlied@redhat.com>2016-02-10 12:00:11 +1000
commit0cb1bd0fff0aa76e0af481858e8272ee3b4377a9 (patch)
treec3f128a3a364c43acbf02163dd2aafb222979e9f
parent2a4d35b8b3d3aa4a676be521f5c614b1b6b852b8 (diff)
renderer: do not accept invalid format
That would later crash in util_format_description() or others Fix found thanks to american fuzzy lop. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r--src/vrend_renderer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index c24b94d..df76637 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -1058,6 +1058,10 @@ int vrend_create_surface(struct vrend_context *ctx,
struct vrend_resource *res;
uint32_t ret_handle;
+ if (format >= PIPE_FORMAT_COUNT) {
+ return EINVAL;
+ }
+
res = vrend_renderer_ctx_res_lookup(ctx, res_handle);
if (!res) {
report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, res_handle);