[master] 0e86a1ed8 vcc: Add missing ERRCHK to vcc_expr5()

Nils Goroll nils.goroll at uplex.de
Thu Jun 3 07:05:06 UTC 2021


commit 0e86a1ed81fc6445a037f9425c76d8a3898537fc
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Jun 2 17:09:27 2021 +0200

    vcc: Add missing ERRCHK to vcc_expr5()
    
    VCC_SymbolGet() could fail, e,g, if the token is reserved
    
    Now with vtc to make the issue more obvious.
    
    OKed by Dridi via IRC
    
    Ref cf396384595ef47cc66f1eedcf0b6730d5b1b659

diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index 47b899585..a12f3295e 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -42,6 +42,14 @@ varnish v1 -errvcl {Symbol 'acl' type (reserved) can not be used in expression.}
 	sub vcl_recv { call acl; }
 }
 
+varnish v1 -errvcl {Symbols named 'vcl_*' are reserved.} {
+	import debug;
+
+	sub vcl_recv {
+		debug.test_probe(vcl_sub1, vcl_sub2);
+	}
+}
+
 varnish v1 -errvcl {Operator * not possible on type STRING.} {
 	sub vcl_recv {
 		set req.http.foo = "bla" * "foo";
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index e85111178..fb5220e4e 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -745,6 +745,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		if (sym == NULL && fmt->global_pfx != NULL && t1->tok != '.') {
 			sym = VCC_SymbolGet(tl, SYM_MAIN, SYM_NONE,
 			    SYMTAB_CREATE, XREF_REF);
+			ERRCHK(tl);
 			AN(sym);
 			VCC_GlobalSymbol(sym, fmt);
 		}


More information about the varnish-commit mailing list