panfrost: Sanity check tiler polygon list size
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 14 Jun 2019 14:21:05 +0000 (07:21 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 17 Jun 2019 14:59:14 +0000 (07:59 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_context.c

index 3c9c8a9f8e68c1af2a4ffdbfcd4a9aea53f6ed04..225561a51d18dc0c8a74009f9b91da48664afaaf 100644 (file)
@@ -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;