From f58e985a63d1ac579bb3bb48cc49ec0fdff7d3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 19 Jan 2016 14:14:34 +0100 Subject: [PATCH] renderer: report error on invalid surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of later crashing. Fix found thanks to american fuzzy lop. Signed-off-by: Marc-André Lureau --- src/vrend_renderer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 20d2946..5374f09 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1530,7 +1530,10 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx, break; } } - assert(surf); + if (surf == NULL) { + report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SURFACE, i); + return; + } new_height = u_minify(surf->texture->base.height0, surf->val0); new_ibf = surf->texture->y_0_top ? true : false; }