[master] 7e9b65c62 vcc: Add missing check for scientific notation

Nils Goroll nils.goroll at uplex.de
Wed Oct 29 18:51:05 UTC 2025


commit 7e9b65c62cc14ca13576de8bee530e748bcf7836
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Oct 29 19:44:16 2025 +0100

    vcc: Add missing check for scientific notation
    
    Fixes another instance of #3971: The added test would trigger an assertion
    failure:
    
    **** v1    CLI RX|Message from VCC-compiler:
    **** v1    CLI RX|Assert error in vcc_lex_number(), vcc_token.c line 505:
    **** v1    CLI RX|  Condition(s == tl->t->e) not true.
    **** v1    CLI RX|Running VCC-compiler failed, signal 6
    **** v1    CLI RX|VCL compilation failed

diff --git a/bin/varnishtest/tests/i00001.vtc b/bin/varnishtest/tests/i00001.vtc
index c29ae5b34..89386490c 100644
--- a/bin/varnishtest/tests/i00001.vtc
+++ b/bin/varnishtest/tests/i00001.vtc
@@ -20,6 +20,11 @@ varnish v1 -errvcl {Unexpected character 'e'.} {
 	sub vcl_recv { set req.http.foo = 42.42e42; }
 }
 
+varnish v1 -errvcl {Unexpected character 'e'.} {
+	import std;
+	sub vcl_synth { set resp.http.foo = std.integer(real=1e10); }
+}
+
 server s1 {
 	rxreq
 	txresp
diff --git a/lib/libvcc/vcc_token.c b/lib/libvcc/vcc_token.c
index e494eefb6..96ece50e3 100644
--- a/lib/libvcc/vcc_token.c
+++ b/lib/libvcc/vcc_token.c
@@ -501,6 +501,8 @@ vcc_lex_number(struct vcc *tl, struct source *sp, const char *p)
 			vcc_ErrWhere(tl, tl->t);
 			return (NULL);
 		}
+		if (! vcc_lex_number_token_valid(tl))
+			return (NULL);
 		tl->t->num = strtod(p, &s);
 		assert(s == tl->t->e);
 		return (q);


More information about the varnish-commit mailing list