pan/bi: Fix out-of-bounds write in va_lower_split_64bit
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 31 Aug 2022 20:54:02 +0000 (16:54 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 16:03:23 +0000 (16:03 +0000)
...with dual source blending. Fixes shaders/dolphin/smg.1.shader_test

There are more IR sources than Valhall machine sources here.

Fixes: b48933d6411 ("pan/va: Include BLEND for va_swap_12")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>

src/panfrost/bifrost/valhall/va_lower_split_64bit.c

index e193ab3..849b911 100644 (file)
@@ -67,7 +67,7 @@ va_lower_split_64bit(bi_context *ctx)
 {
    bi_foreach_instr_global(ctx, I) {
       bi_foreach_src(I, s) {
-         if (bi_is_null(I->src[s]))
+         if (bi_is_null(I->src[s]) || s >= 4)
             continue;
 
          struct va_src_info info = va_src_info(I->op, s);