diff options
author | chefmax <chefmax@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-20 13:33:28 +0000 |
---|---|---|
committer | chefmax <chefmax@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-20 13:33:28 +0000 |
commit | fea7cc1e81a6fb12d5a26c459d33bbdca69a25f0 (patch) | |
tree | fd8dcedd9f898e8f346830bcc90cd385e5f4cca4 /gcc/asan.c | |
parent | 49c3fb73a9651c7504f996bc65409b20800c6aba (diff) | |
download | gcc-fea7cc1e81a6fb12d5a26c459d33bbdca69a25f0.tar.gz |
2014-06-18 Yury Gribov <y.gribov@samsung.com>
gcc/
* asan.c (instrument_strlen_call): Fixed instrumentation of
trailing byte.
gcc/testsuite/
* c-c++-common/asan/strlen-overflow-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211849 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/asan.c')
-rw-r--r-- | gcc/asan.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/asan.c b/gcc/asan.c index 4d87dad7011..9e696a4c084 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -2037,19 +2037,19 @@ instrument_strlen_call (gimple_stmt_iterator *iter) build_check_stmt (loc, gimple_assign_lhs (str_arg_ssa), NULL_TREE, 1, iter, /*non_zero_len_p*/true, /*before_p=*/true, - /*is_store=*/false, /*is_scalar_access*/false, /*align*/0); + /*is_store=*/false, /*is_scalar_access*/true, /*align*/0); - gimple stmt = - gimple_build_assign_with_ops (PLUS_EXPR, - make_ssa_name (TREE_TYPE (len), NULL), - len, - build_int_cst (TREE_TYPE (len), 1)); - gimple_set_location (stmt, loc); - gsi_insert_after (iter, stmt, GSI_NEW_STMT); + gimple g = + gimple_build_assign_with_ops (POINTER_PLUS_EXPR, + make_ssa_name (cptr_type, NULL), + gimple_assign_lhs (str_arg_ssa), + len); + gimple_set_location (g, loc); + gsi_insert_after (iter, g, GSI_NEW_STMT); - build_check_stmt (loc, gimple_assign_lhs (stmt), len, 1, iter, + build_check_stmt (loc, gimple_assign_lhs (g), NULL_TREE, 1, iter, /*non_zero_len_p*/true, /*before_p=*/false, - /*is_store=*/false, /*is_scalar_access*/false, /*align*/0); + /*is_store=*/false, /*is_scalar_access*/true, /*align*/0); return true; } |