From: phk Date: Sun, 5 Oct 2008 22:28:13 +0000 (+0000) Subject: Fix a truly obscure bug in compiler message error reporting: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a9c21791147f5e51bb437bc5225c2bd137a3019;p=varnish 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: svn+ssh://projects.linpro.no/svn/varnish/trunk@3257 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvcl/vcc_token.c b/varnish-cache/lib/libvcl/vcc_token.c index 093c317c..787ed188 100644 --- a/varnish-cache/lib/libvcl/vcc_token.c +++ b/varnish-cache/lib/libvcl/vcc_token.c @@ -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");