tgsi: fix out of bounds access in exec_atomop()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 31 Mar 2016 08:54:17 +0000 (10:54 +0200)
committerDave Airlie <airlied@redhat.com>
Thu, 31 Mar 2016 21:15:16 +0000 (07:15 +1000)
The number of channels must be 4 for all RGBA components.

Fixes: 22d129601 ("tgsi: add support for image operations to tgsi_exec. (v2.1)")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/tgsi/tgsi_exec.c

index e7f080eb12373528892a156cfa6e808ac06725d1..72d8c5a724746b87dc8266a05a7bdccffcb804ec 100644 (file)
@@ -3853,7 +3853,7 @@ static void
 exec_atomop(struct tgsi_exec_machine *mach,
             const struct tgsi_full_instruction *inst)
 {
-   union tgsi_exec_channel r[3], sample_r;
+   union tgsi_exec_channel r[4], sample_r;
    union tgsi_exec_channel value[4], value2[4];
    float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
    float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];