diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-11-26 22:27:19 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-11-26 22:27:19 +0100 |
commit | 13a5b41c7da58117719d5b29dd18cb0ca5807cfe (patch) | |
tree | 907de8a6b705dcc379afc2ccf676a1b32f7a8892 /gcc | |
parent | 1f2541577e34768653efaaf876b1ff744b06aa07 (diff) | |
download | gcc-13a5b41c7da58117719d5b29dd18cb0ca5807cfe.zip gcc-13a5b41c7da58117719d5b29dd18cb0ca5807cfe.tar.gz gcc-13a5b41c7da58117719d5b29dd18cb0ca5807cfe.tar.bz2 |
re PR sanitizer/59258 (ubsan: ICE(segfault): stack-buffer-overflow with -fsanitize=undefined)
PR sanitizer/59258
* ubsan.c (ubsan_source_location): Don't add any location
to ADDR_EXPR in the ctor. Revert 2013-11-22 change.
(ubsan_create_data): Strip block info from LOC.
From-SVN: r205415
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ubsan.c | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f2edd4..3a18e50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2013-11-26 Jakub Jelinek <jakub@redhat.com> + PR sanitizer/59258 + * ubsan.c (ubsan_source_location): Don't add any location + to ADDR_EXPR in the ctor. Revert 2013-11-22 change. + (ubsan_create_data): Strip block info from LOC. + PR middle-end/59273 * tree-vect-generic.c (optimize_vector_constructor): Don't optimize if there isn't optab handler for the corresponding vector PLUS_EXPR. diff --git a/gcc/ubsan.c b/gcc/ubsan.c index a16f3eb..468a3b1 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -229,13 +229,13 @@ ubsan_source_location (location_t loc) xloc = expand_location (loc); /* Fill in the values from LOC. */ - size_t len = xloc.file ? strlen (xloc.file) : 0; - tree str = build_string (len + 1, xloc.file ? xloc.file : ""); + size_t len = strlen (xloc.file); + tree str = build_string (len + 1, xloc.file); TREE_TYPE (str) = build_array_type (char_type_node, build_index_type (size_int (len))); TREE_READONLY (str) = 1; TREE_STATIC (str) = 1; - str = build_fold_addr_expr_loc (loc, str); + str = build_fold_addr_expr (str); tree ctor = build_constructor_va (type, 3, NULL_TREE, str, NULL_TREE, build_int_cst (unsigned_type_node, xloc.line), NULL_TREE, @@ -398,6 +398,7 @@ ubsan_create_data (const char *name, location_t loc, tree td_type = ubsan_type_descriptor_type (); TYPE_READONLY (td_type) = 1; td_type = build_pointer_type (td_type); + loc = LOCATION_LOCUS (loc); /* Create the structure type. */ ret = make_node (RECORD_TYPE); |