aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYury Gribov <y.gribov@samsung.com>2014-06-20 10:26:55 +0000
committerMaxim Ostapenko <chefmax@gcc.gnu.org>2014-06-20 13:26:55 +0300
commitbf613c022efe5ef454c39d20d555c552995ec899 (patch)
treea90cccc29da8013665a2c131a5bfee558100c135 /gcc
parent803d0ab0e8ca92a0dcfa721771854c49ec3c1256 (diff)
downloadgcc-bf613c022efe5ef454c39d20d555c552995ec899.zip
gcc-bf613c022efe5ef454c39d20d555c552995ec899.tar.gz
gcc-bf613c022efe5ef454c39d20d555c552995ec899.tar.bz2
re PR sanitizer/61530 (segfault with asan)
2014-06-18 Yury Gribov <y.gribov@samsung.com> gcc/ PR sanitizer/61530 * asan.c (build_check_stmt): Add condition. gcc/testsuite/ * c-c++-common/asan/pr61530.c: New test. Co-Authored-By: Max Ostapenko <m.ostapenko@partner.samsung.com> From-SVN: r211846
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/asan.c1
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/c-c++-common/asan/pr61530.c17
4 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6b66a35..f26115d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-20 Yury Gribov <y.gribov@samsung.com>
+ Max Ostapenko <m.ostapenko@partner.samsung.com>
+
+ PR sanitizer/61530
+ * asan.c (build_check_stmt): Add condition.
+
2014-06-20 Martin Jambor <mjambor@suse.cz>
PR ipa/61211
diff --git a/gcc/asan.c b/gcc/asan.c
index 281a795..4d87dad 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1654,6 +1654,7 @@ build_check_stmt (location_t location, tree base, tree len,
if (size_in_bytes > 1)
{
if ((size_in_bytes & (size_in_bytes - 1)) != 0
+ || !is_scalar_access
|| size_in_bytes > 16)
size_in_bytes = -1;
else if (align && align < size_in_bytes * BITS_PER_UNIT)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b64b33c..ffb5caf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-20 Yury Gribov <y.gribov@samsung.com>
+ Max Ostapenko <m.ostapenko@partner.samsung.com>
+
+ PR sanitizer/61530
+ * c-c++-common/asan/pr61530.c: New test.
+
2014-06-16 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/simd/vqdmulhh_lane_s16.c: New test.
diff --git a/gcc/testsuite/c-c++-common/asan/pr61530.c b/gcc/testsuite/c-c++-common/asan/pr61530.c
new file mode 100644
index 0000000..e306a71
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/pr61530.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+__attribute__((noinline,noclone)) void
+foo (char *a, char *b) {
+ a[0] = b[0] = 0;
+ __builtin_memcpy(a, b, 4);
+}
+
+int
+main () {
+ char a, b;
+ foo (&a, &b);
+ return 0;
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */