aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-09-01 19:17:40 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-09-01 19:17:40 -0400
commit1a6e3d5275c3ca70423631b6679eae1cc8b6681f (patch)
treed2fd03cfb6c450d8d78aa546487708046fecb06b
parentaae43c5f402c830a993c2f4c93966c8512182d19 (diff)
downloadgcc-1a6e3d5275c3ca70423631b6679eae1cc8b6681f.zip
gcc-1a6e3d5275c3ca70423631b6679eae1cc8b6681f.tar.gz
gcc-1a6e3d5275c3ca70423631b6679eae1cc8b6681f.tar.bz2
(make_definition): Don't dump core when given an unterminated string
in a -D option. From-SVN: r8013
-rw-r--r--gcc/cccp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index aa564fd..bcc0edc 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -9289,7 +9289,18 @@ make_definition (str, op)
p++;
q = &buf[p - str];
while (*p) {
- if (*p == '\\' && p[1] == '\n')
+ if (*p == '\"' || *p == '\'') {
+ int unterminated = 0;
+ U_CHAR *p1 = skip_quoted_string (p, p + strlen (p), 0,
+ NULL_PTR, NULL_PTR, &unterminated);
+ if (unterminated)
+ return;
+ while (p != p1)
+ if (*p == '\\' && p[1] == '\n')
+ p += 2;
+ else
+ *q++ = *p++;
+ } else if (*p == '\\' && p[1] == '\n')
p += 2;
/* Change newline chars into newline-markers. */
else if (*p == '\n')