Commit bfd36535 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix a truly obscure bug in compiler message error reporting:

If the error references the first token and there is no preceding
newline we would core dump.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3257 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f56e512a
......@@ -79,6 +79,8 @@ vcc_icoord(struct vsb *vsb, const struct token *t, const char **ll)
pos = 0;
sp = t->src;
b = sp->b;
if (ll != NULL)
*ll = b;
for (p = b; p < t->b; p++) {
if (*p == '\n') {
lin++;
......@@ -379,12 +381,13 @@ vcc_Lexer(struct tokenlist *tl, struct source *sp)
for (q = p + 2; q < sp->e; q++) {
if (*q == '}' && q[1] == 'C') {
vcc_AddToken(tl, CSRC, p, q + 2);
p = q + 2;
break;
}
}
if (q < sp->e)
if (q < sp->e) {
p = q + 2;
continue;
}
vcc_AddToken(tl, EOI, p, p + 2);
vsb_printf(tl->sb,
"Unterminated inline C source, starting at\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment