panfrost/decode: Don't disassemble NULL shaders
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 17 Jul 2019 22:43:24 +0000 (15:43 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 18 Jul 2019 17:42:43 +0000 (10:42 -0700)
It is legal to load a shader from a NULL address, particularly when the
TILER job is used strictly for effects on the Z/S buffer with 0x0 color
mask. Don't crash the decoder in this case.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/pandecode/decode.c

index 4eaf09fd3426d4d4461fc7903886b76f66e19855..4132dc530ee6c5df0464a3824af29572b62787e8 100644 (file)
@@ -1603,12 +1603,13 @@ pandecode_vertex_tiler_postfix_pre(const struct mali_vertex_tiler_postfix *p,
                                 else
                                         shader = pandecode_midgard_blend_mrt(blend_base, job_no, i);
 
-                                if (shader)
+                                if (shader & ~0xF)
                                         pandecode_shader_disassemble(shader, job_no, job_type, false);
                         }
                 }
 
-                pandecode_shader_disassemble(shader_ptr, job_no, job_type, is_bifrost);
+                if (shader_ptr & ~0xF)
+                   pandecode_shader_disassemble(shader_ptr, job_no, job_type, is_bifrost);
         } else
                 pandecode_msg("<no shader>\n");