xf86-video-intel: src/sna/brw
Chris Wilson
ickle at kemper.freedesktop.org
Mon Dec 1 06:32:09 PST 2014
src/sna/brw/brw_eu_emit.c | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit 9c2c485df9fd39ae36779f765a892e36835a8001
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Dec 1 14:26:46 2014 +0000
sna: Validate that the reg/insn size is well defined
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/brw/brw_eu_emit.c b/src/sna/brw/brw_eu_emit.c
index 5c0b306..00c984d 100644
--- a/src/sna/brw/brw_eu_emit.c
+++ b/src/sna/brw/brw_eu_emit.c
@@ -34,6 +34,8 @@
#include <string.h>
#include <stdlib.h>
+#define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
+
/***********************************************************************
* Internal helper for constructing instructions
*/
@@ -179,6 +181,11 @@ validate_reg(struct brw_instruction *insn, struct brw_reg reg)
reg.file == BRW_ARF_NULL)
return;
+ assert(reg.hstride >= 0 && reg.hstride < ARRAY_SIZE(hstride_for_reg));
+ assert(reg.vstride >= 0 && reg.vstride < ARRAY_SIZE(vstride_for_reg));
+ assert(reg.width >= 0 && reg.width < ARRAY_SIZE(width_for_reg));
+ assert(insn->header.execution_size >= 0 && insn->header.execution_size < ARRAY_SIZE(execsize_for_reg));
+
hstride = hstride_for_reg[reg.hstride];
if (reg.vstride == 0xf) {
More information about the xorg-commit
mailing list