* [PATCH] [asan] Fix a thinko leading to a crash
@ 2013-02-13 20:37 Dodji Seketeli
2013-02-13 20:45 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Dodji Seketeli @ 2013-02-13 20:37 UTC (permalink / raw)
To: Jakub Jelinek, Kostya Serebryany, Dmitry Vyukov; +Cc: GCC Patches
Hello,
It appeared that in my previous patch, a stupid thinko can lead to a
crash when instrumenting some builtin functionsK. Fixed thus.
Tested against trunk on x86_64-unknown-linux-gnu, and a bootstrap is underway.
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.
---
gcc/asan.c | 2 +-
gcc/testsuite/c-c++-common/asan/memcmp-2.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/c-c++-common/asan/memcmp-2.c
diff --git a/gcc/asan.c b/gcc/asan.c
index 3cb9511..7783723 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1764,7 +1764,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/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);
+}
--
Dodji
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [asan] Fix a thinko leading to a crash
2013-02-13 20:37 [PATCH] [asan] Fix a thinko leading to a crash Dodji Seketeli
@ 2013-02-13 20:45 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2013-02-13 20:45 UTC (permalink / raw)
To: Dodji Seketeli; +Cc: Kostya Serebryany, Dmitry Vyukov, GCC Patches
On Wed, Feb 13, 2013 at 09:37:42PM +0100, Dodji Seketeli wrote:
> Hello,
>
> It appeared that in my previous patch, a stupid thinko can lead to a
> crash when instrumenting some builtin functionsK. Fixed thus.
>
> Tested against trunk on x86_64-unknown-linux-gnu, and a bootstrap is underway.
>
> 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.
Ok, thanks.
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-13 20:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13 20:37 [PATCH] [asan] Fix a thinko leading to a crash Dodji Seketeli
2013-02-13 20:45 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).