diff options
author | Martin Liska <mliska@suse.cz> | 2016-02-04 12:50:40 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2016-02-04 11:50:40 +0000 |
commit | 7db337c247a6f34708b502016d58c2ef9991b2a8 (patch) | |
tree | 4ea923ad0597971e1d4ac18debc076d5c683892c /gcc/asan.c | |
parent | 60d27907cc2cfb233ceb5e76bba3ed82ab9b21c7 (diff) | |
download | gcc-7db337c247a6f34708b502016d58c2ef9991b2a8.zip gcc-7db337c247a6f34708b502016d58c2ef9991b2a8.tar.gz gcc-7db337c247a6f34708b502016d58c2ef9991b2a8.tar.bz2 |
re PR sanitizer/69276 (Address sanitizer does not handle heap overflow)
Fix PR sanitizer/69276
* g++.dg/asan/pr69276.C: New test.
PR sanitizer/PR69276
* asan.c (has_stmt_been_instrumented_p): Instrument gimple calls
that are gimple_store_p.
(maybe_instrument_call): Likewise.
From-SVN: r233137
Diffstat (limited to 'gcc/asan.c')
-rw-r--r-- | gcc/asan.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -897,6 +897,16 @@ has_stmt_been_instrumented_p (gimple *stmt) return true; } } + else if (is_gimple_call (stmt) && gimple_store_p (stmt)) + { + asan_mem_ref r; + asan_mem_ref_init (&r, NULL, 1); + + r.start = gimple_call_lhs (stmt); + r.access_size = int_size_in_bytes (TREE_TYPE (r.start)); + return has_mem_ref_been_instrumented (&r); + } + return false; } @@ -2038,6 +2048,18 @@ maybe_instrument_call (gimple_stmt_iterator *iter) gimple_set_location (g, gimple_location (stmt)); gsi_insert_before (iter, g, GSI_SAME_STMT); } + + if (gimple_store_p (stmt)) + { + tree ref_expr = gimple_call_lhs (stmt); + instrument_derefs (iter, ref_expr, + gimple_location (stmt), + /*is_store=*/true); + + gsi_next (iter); + return true; + } + return false; } |