diff options
author | Dodji Seketeli <dodji@redhat.com> | 2013-02-14 04:37:56 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2013-02-14 05:37:56 +0100 |
commit | 8fb067263b60e184b2e0d303e1b8d40166e2bec4 (patch) | |
tree | c03eb36fdcf82d669b4a77807ee77c250bdb6195 | |
parent | 28d5c77761402501ed6604c581d27410c22bbf4b (diff) | |
download | gcc-8fb067263b60e184b2e0d303e1b8d40166e2bec4.zip gcc-8fb067263b60e184b2e0d303e1b8d40166e2bec4.tar.gz gcc-8fb067263b60e184b2e0d303e1b8d40166e2bec4.tar.bz2 |
[asan] Fix a thinko leading to a crash
It appeared that in my previous patch, a stupid thinko can lead to a
crash when instrumenting some builtin functionsK. Fixed thus.
Bootstrapped and tested against trunk on x86_64-unknown-linux-gnu.
gcc/
* asan.c (instrument_builtin_call): Really put the length of the
second source argument into src1_len.
gcc/testsuite/
* c-c++-common/asan/memcmp-2.c: New test.
From-SVN: r196044
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/asan.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/asan/memcmp-2.c | 10 |
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4dd2753..25e4f0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-02-14 Dodji Seketeli <dodji@redhat.com> + + Fix an asan crash + * asan.c (instrument_builtin_call): Really put the length of the + second source argument into src1_len. + 2013-02-13 Jakub Jelinek <jakub@redhat.com> * asan.c (create_cond_insert_point): Add create_then_fallthru_edge @@ -1771,7 +1771,7 @@ instrument_builtin_call (gimple_stmt_iterator *iter) if (get_mem_refs_of_builtin_call (call, &src0, &src0_len, &src0_is_store, - &src1, &src0_len, &src1_is_store, + &src1, &src1_len, &src1_is_store, &dest, &dest_len, &dest_is_store, &dest_is_deref)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e4f70ce..e3ae57d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-14 Dodji Seketeli <dodji@redhat.com> + + Fix an asan crash + * c-c++-common/asan/memcmp-2.c: New test. + 2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/55582 diff --git a/gcc/testsuite/c-c++-common/asan/memcmp-2.c b/gcc/testsuite/c-c++-common/asan/memcmp-2.c new file mode 100644 index 0000000..be20cd8 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/memcmp-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +int +foo () +{ + char s0[5] = {0}; + char s1[5] = {1}; + + return __builtin_memcmp (s0, s1, 2); +} |