From e2c2ccd5b8e38d6899bf9aea8fc7f17f3f6442e5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Jun 2019 07:21:05 -0700 Subject: [PATCH] panfrost: Sanity check tiler polygon list size Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_context.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 3c9c8a9f8e6..225561a51d1 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -178,6 +178,11 @@ panfrost_emit_mfbd(struct panfrost_context *ctx) unsigned body_size = panfrost_tiler_body_size( width, height, framebuffer.tiler_hierarchy_mask); + /* Sanity check */ + + unsigned total_size = header_size + body_size; + assert(ctx->misc_0.size >= total_size); + framebuffer.tiler_polygon_list_body = framebuffer.tiler_polygon_list + header_size;