r600g/sb: Don't crash on empty if jump target
authorGlenn Kennard <glenn.kennard@gmail.com>
Thu, 27 Aug 2015 17:04:17 +0000 (19:04 +0200)
committerDave Airlie <airlied@redhat.com>
Fri, 28 Aug 2015 02:32:36 +0000 (12:32 +1000)
Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/sb/sb_bc_parser.cpp

index 748aae29eebb754616c1972f9fbea83dae1d54eb..c4799270d9f7c16ebeeaad97e782e954178b4224 100644 (file)
@@ -792,6 +792,9 @@ int bc_parser::prepare_if(cf_node* c) {
        assert(c->bc.addr-1 < cf_map.size());
        cf_node *c_else = NULL, *end = cf_map[c->bc.addr];
 
+       if (!end)
+               return 0; // not quite sure how this happens, malformed input?
+
        BCP_DUMP(
                sblog << "parsing JUMP @" << c->bc.id;
                sblog << "\n";
@@ -817,7 +820,7 @@ int bc_parser::prepare_if(cf_node* c) {
        if (c_else->parent != c->parent)
                c_else = NULL;
 
-       if (end->parent != c->parent)
+       if (end && end->parent != c->parent)
                end = NULL;
 
        region_node *reg = sh->create_region();