[PATCH 1/2] Add an ERRCHK point in vcc_expr0() in the VCL compiler to catch unresolved symbols from vcc_expr4().
Martin Blix Grydeland
martin at varnish-software.com
Thu Apr 12 13:42:15 CEST 2012
Fixes: #1125
---
bin/varnishtest/tests/r01125.vtc | 9 +++++++++
lib/libvcl/vcc_expr.c | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
create mode 100644 bin/varnishtest/tests/r01125.vtc
diff --git a/bin/varnishtest/tests/r01125.vtc b/bin/varnishtest/tests/r01125.vtc
new file mode 100644
index 0000000..dda1171
--- /dev/null
+++ b/bin/varnishtest/tests/r01125.vtc
@@ -0,0 +1,9 @@
+varnishtest "#1125 unresolved first arg to regsub causes VCL compiler segfault"
+
+varnish v1 -badvcl {
+ backend b { .host = "127.0.0.1"; }
+
+ sub vcl_recv {
+ set req.url = regsub(reg.url, "\?[^?]+$", "");
+ }
+}
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 203d76f..a4ed74e 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -454,6 +454,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
SkipToken(tl, '(');
vcc_expr0(tl, &e2, STRING);
+ ERRCHK(tl);
if (e2->fmt != STRING)
vcc_expr_tostring(&e2, STRING);
--
1.7.4.1
More information about the varnish-dev
mailing list