r3257 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Mon Oct 6 00:28:13 CEST 2008


Author: phk
Date: 2008-10-06 00:28:13 +0200 (Mon, 06 Oct 2008)
New Revision: 3257

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_token.c
Log:
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.



Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token.c	2008-10-05 22:10:14 UTC (rev 3256)
+++ trunk/varnish-cache/lib/libvcl/vcc_token.c	2008-10-05 22:28:13 UTC (rev 3257)
@@ -79,6 +79,8 @@
 	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 @@
 			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");




More information about the varnish-commit mailing list