From 6a9c21791147f5e51bb437bc5225c2bd137a3019 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 5 Oct 2008 22:28:13 +0000 Subject: [PATCH] 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 --- varnish-cache/lib/libvcl/vcc_token.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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"); -- 2.39.5