spirv: Properly size the src[] array.
authorMatt Turner <mattst88@gmail.com>
Mon, 16 May 2016 19:48:00 +0000 (12:48 -0700)
committerMatt Turner <mattst88@gmail.com>
Wed, 18 May 2016 18:09:37 +0000 (11:09 -0700)
Operations like nir_op_bitfield_insert have four arguments, and Coverity
isn't privy to the fact that 4-argument operations aren't possible here,
so it thinks this can lead to memory corruption. Just increase the size
of the array to quell any fears.

src/compiler/spirv/spirv_to_nir.c

index c65f971ad79e86f880d3f2a9ac317689075c2ed4..56948bf8a3fc38d45a5f574bf2c0316843c1dc1d 100644 (file)
@@ -1036,7 +1036,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
          unsigned bit_size =
             glsl_get_bit_size(val->const_type);
 
-         nir_const_value src[3];
+         nir_const_value src[4];
          assert(count <= 7);
          for (unsigned i = 0; i < count - 4; i++) {
             nir_constant *c =