r300: assert that array in translate_vertex_program is initialized
authorFilip Gawin <filip.gawin@zoho.com>
Wed, 15 Sep 2021 22:32:03 +0000 (00:32 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 17 Sep 2021 07:19:24 +0000 (07:19 +0000)
Problematic usage is in case RC_OPCODE_ENDLOOP, at line
ret_addr = loops[--loop_depth];

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12880>

src/gallium/drivers/r300/compiler/r3xx_vertprog.c

index 1f1c9ad..63cb447 100644 (file)
@@ -369,7 +369,7 @@ static void translate_vertex_program(struct radeon_compiler *c, void *user)
        struct r300_vertex_program_compiler *compiler = (struct r300_vertex_program_compiler*)c;
        struct rc_instruction *rci;
 
-       unsigned loops[R500_PVS_MAX_LOOP_DEPTH];
+       unsigned loops[R500_PVS_MAX_LOOP_DEPTH] = {};
        unsigned loop_depth = 0;
 
        compiler->code->pos_end = 0;    /* Not supported yet */