summaryrefslogtreecommitdiff
path: root/gcc/sanitizer.def
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-03 17:59:31 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-03 17:59:31 +0000
commit2c4c347700af66c7e5ce7c0f998270613e62b988 (patch)
tree47ea0e1220f5468397f6fdb89cae25257bd9e763 /gcc/sanitizer.def
parentea151fae4de4aca6d2ce029bd7fe00ded77b0e9c (diff)
downloadgcc-2c4c347700af66c7e5ce7c0f998270613e62b988.tar.gz
Implement -fsanitize=vla-bound.
* opts.c (common_handle_option): Handle vla-bound. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE): Define. * flag-types.h (enum sanitize_code): Add SANITIZE_VLA. * asan.c (initialize_sanitizer_builtins): Build BT_FN_VOID_PTR_PTR. c-family/ * c-ubsan.c: Don't include hash-table.h. (ubsan_instrument_vla): New function. * c-ubsan.h: Declare it. cp/ * decl.c (cp_finish_decl): Move C++1y bounds checking... (compute_array_index_type): ...here. Add VLA instrumentation. Call stabilize_vla_size. (grokdeclarator): Don't call stabilize_vla_size here. c/ * c-decl.c (grokdeclarator): Add VLA instrumentation. testsuite/ * g++.dg/ubsan/cxx1y-vla.C: New test. * c-c++-common/ubsan/vla-3.c: New test. * c-c++-common/ubsan/vla-2.c: New test. * c-c++-common/ubsan/vla-4.c: New test. * c-c++-common/ubsan/vla-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sanitizer.def')
-rw-r--r--gcc/sanitizer.def4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/sanitizer.def b/gcc/sanitizer.def
index 4c8a0377d8b..c7c780929b8 100644
--- a/gcc/sanitizer.def
+++ b/gcc/sanitizer.def
@@ -297,3 +297,7 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE,
"__ubsan_handle_builtin_unreachable",
BT_FN_VOID_PTR,
ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
+DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE,
+ "__ubsan_handle_vla_bound_not_positive",
+ BT_FN_VOID_PTR_PTR,
+ ATTR_COLD_NOTHROW_LEAF_LIST)