[master] aa07de4 Don't allow symbols in expressions unless we can evaluate them.

Poul-Henning Kamp phk at varnish-cache.org
Mon May 23 09:19:58 CEST 2011


commit aa07de47e21abce49b35a51d27c80c03b71e0f36
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 23 07:19:17 2011 +0000

    Don't allow symbols in expressions unless we can evaluate them.
    
    Fixes:	#916

diff --git a/bin/varnishtest/tests/r00916.vtc b/bin/varnishtest/tests/r00916.vtc
new file mode 100644
index 0000000..bf2ee63
--- /dev/null
+++ b/bin/varnishtest/tests/r00916.vtc
@@ -0,0 +1,16 @@
+varnishtest "VCC reference bug"
+
+server s1 {
+	rxreq
+	txresp -body "FOO"
+} -start
+
+varnish v1 -badvcl {
+	sub s1 {
+	}
+	sub vcl_fetch {
+	    if (req.backend == s-1){
+		set req.backend = s-1;
+	    }
+	}
+}
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 0839e8b..43e6ee1 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -656,7 +656,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
 		 * XXX: look for SYM_VAR first for consistency ?
 		 */
 		sym = VCC_FindSymbol(tl, tl->t, SYM_NONE);
-		if (sym == NULL) {
+		if (sym == NULL || sym->eval == NULL) {
 			vsb_printf(tl->sb, "Symbol not found: ");
 			vcc_ErrToken(tl, tl->t);
 			vsb_printf(tl->sb, " (expected type %s):\n",



More information about the varnish-commit mailing list