ref: b213e5a835707e8d347e804d9911c13526138f07
parent: 7b0ece05732ca278a0e18e40c16f29804f01c5cc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon May 11 06:10:16 EDT 2015
Add better error control in #line
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -85,6 +85,8 @@
{
char *p, *q;
+ if (!isdigit(*p))
+ goto bad_line;
for (p = s; isdigit(*p); ++p)
/* nothing */;
switch (*p) {
@@ -106,11 +108,13 @@
setfline(atoi(s)-1);
return p;
default:
- goto bad_line;
+ goto bad_file;
}
+bad_file:
+ error("second parameter of #line is not a valid filename");
bad_line:
- error("incorrect #line directive");
+ error("first parameter of #line is not a positive integer");
}
static char *