aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/i386
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-10-20 00:51:34 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-10-25 17:35:07 +0200
commit45b5933f7afb055080e915c83663f3a4709a02db (patch)
tree462af7d0c6a48aaac4c31d03be2274da8c44cbff /tests/tcg/i386
parenta95260486aa7e78d7c7194eba65cf03311ad94ad (diff)
downloadqemu-45b5933f7afb055080e915c83663f3a4709a02db.zip
qemu-45b5933f7afb055080e915c83663f3a4709a02db.tar.gz
qemu-45b5933f7afb055080e915c83663f3a4709a02db.tar.bz2
tests/tcg: fix out-of-bounds access in test-avx
This can cause differences between native and QEMU execution, due to ASLR. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/tcg/i386')
-rw-r--r--tests/tcg/i386/test-avx.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/tcg/i386/test-avx.c b/tests/tcg/i386/test-avx.c
index c39c0e5..910b067 100644
--- a/tests/tcg/i386/test-avx.c
+++ b/tests/tcg/i386/test-avx.c
@@ -236,12 +236,15 @@ v4di val_i64[] = {
v4di deadbeef = {0xa5a5a5a5deadbeefull, 0xa5a5a5a5deadbeefull,
0xa5a5a5a5deadbeefull, 0xa5a5a5a5deadbeefull};
-v4di indexq = {0x000000000000001full, 0x000000000000008full,
- 0xffffffffffffffffull, 0xffffffffffffff5full};
-v4di indexd = {0x00000002000000efull, 0xfffffff500000010ull,
- 0x0000000afffffff0ull, 0x000000000000000eull};
+/* &gather_mem[0x10] is 512 bytes from the base; indices must be >=-64, <64
+ * to account for scaling by 8 */
+v4di indexq = {0x000000000000001full, 0x000000000000003dull,
+ 0xffffffffffffffffull, 0xffffffffffffffdfull};
+v4di indexd = {0x00000002ffffffcdull, 0xfffffff500000010ull,
+ 0x0000003afffffff0ull, 0x000000000000000eull};
v4di gather_mem[0x20];
+_Static_assert(sizeof(gather_mem) == 1024);
void init_f16reg(v4di *r)
{