summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-05-26 11:11:32 -0400
committerRob Clark <[email protected]>2016-05-26 15:17:49 -0400
commit6e51fe75a4997328625753c9409b328f207d5e51 (patch)
tree37263384d353b0ce27a61ad5340365db1ce80359
parent3d66ba971e984a1c58eda6a938a37f58ba6f8134 (diff)
tgsi: fix coverity out-of-bounds warning
CID 1271532 (#1 of 1): Out-of-bounds read (OVERRUN)34. overrun-local: Overrunning array of 2 16-byte elements at element index 2 (byte offset 32) by dereferencing pointer &inst.Dst[i]. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 955d04234ef..8bdec0685ec 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1081,6 +1081,9 @@ parse_instruction(
inst.Memory.Qualifier = 0;
}
+ assume(info->num_dst <= TGSI_FULL_MAX_DST_REGISTERS);
+ assume(info->num_src <= TGSI_FULL_MAX_SRC_REGISTERS);
+
/* Parse instruction operands.
*/
for (i = 0; i < info->num_dst + info->num_src + info->is_tex; i++) {