summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch49
1 files changed, 0 insertions, 49 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch b/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch
deleted file mode 100644
index c0adef6f2f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-7.3/fix-segmentation-fault-precompiled-hdr.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1
2Prevent a segmentation fault which occurs when using incorrect
3structure trying to access name of some named operators, such as
4CPP_NOT, CPP_AND etc. "token->val.node.spelling" cannot be used in
5those cases, as is may not be initialized at all.
6
7
8[YOCTO #11738]
9
10Upstream-Status: Pending
11
12Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
13
14diff --git a/libcpp/lex.c b/libcpp/lex.c
15--- a/libcpp/lex.c
16+++ b/libcpp/lex.c
17@@ -3229,11 +3229,27 @@
18 spell_ident:
19 case SPELL_IDENT:
20 if (forstring)
21- {
22- memcpy (buffer, NODE_NAME (token->val.node.spelling),
23- NODE_LEN (token->val.node.spelling));
24- buffer += NODE_LEN (token->val.node.spelling);
25- }
26+ {
27+ if (token->type == CPP_NAME)
28+ {
29+ memcpy (buffer, NODE_NAME (token->val.node.spelling),
30+ NODE_LEN (token->val.node.spelling));
31+ buffer += NODE_LEN (token->val.node.spelling);
32+ break;
33+ }
34+ /* NAMED_OP, cannot use node.spelling */
35+ if (token->flags & NAMED_OP)
36+ {
37+ const char *str = cpp_named_operator2name (token->type);
38+ if (str)
39+ {
40+ size_t len = strlen(str);
41+ memcpy(buffer, str, len);
42+ buffer += len;
43+ }
44+ break;
45+ }
46+ }
47 else
48 buffer = _cpp_spell_ident_ucns (buffer, token->val.node.node);
49 break;