nir/validate: validate the stride for deref_ptr_as_array
authorKarol Herbst <kherbst@redhat.com>
Thu, 5 Mar 2020 21:13:24 +0000 (22:13 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 14 May 2020 15:13:13 +0000 (15:13 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4068>

src/compiler/nir/nir_validate.c

index 998017d504ab56959b022f74a56ed29753487bdc..70ddda3e98bda10311bb6d9723662c3993ef42ab 100644 (file)
@@ -482,6 +482,7 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state)
                          parent->deref_type == nir_deref_type_array ||
                          parent->deref_type == nir_deref_type_ptr_as_array ||
                          parent->deref_type == nir_deref_type_cast);
+         validate_assert(state, nir_deref_instr_ptr_as_array_stride(parent));
          validate_src(&instr->arr.index, state,
                       nir_dest_bit_size(instr->dest), 1);
          break;