Mesa (master): i965: Fix invalid pointer read in dead_control_flow_eliminate().

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Apr 4 21:35:56 UTC 2016


Module: Mesa
Branch: master
Commit: da5d08707bf07c76b6a1851f3a36bb7c1f8d4d4b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=da5d08707bf07c76b6a1851f3a36bb7c1f8d4d4b

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 30 12:00:02 2016 -0700

i965: Fix invalid pointer read in dead_control_flow_eliminate().

There may not be a previous block.  In this case, there's no real work
to do, so just continue on to the next one.

v2: Update for bblock->prev() API change.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
index 2c1abaf..114dc6c 100644
--- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
@@ -42,6 +42,10 @@ dead_control_flow_eliminate(backend_shader *s)
 
    foreach_block_safe (block, s->cfg) {
       bblock_t *prev_block = block->prev();
+
+      if (!prev_block)
+         continue;
+
       backend_instruction *const inst = block->start();
       backend_instruction *const prev_inst = prev_block->end();
 




More information about the mesa-commit mailing list