[4.1] ea11249 Add simple error checking in ESI processing

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Mon Apr 25 16:15:07 CEST 2016


commit ea11249a3f281216ada1746f9cd25dac483cc5ed
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date:   Tue Apr 19 17:00:24 2016 +0200

    Add simple error checking in ESI processing
    
    When the VEP state machine is in a bad state during finalization
    (VEP_Finish), we log this as an ESI error.

diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index df9eec1..cca9208 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -1085,6 +1085,14 @@ VEP_Finish(struct vep_state *vep)
 	if (vep->attr_vsb)
 		VSB_destroy(&vep->attr_vsb);
 
+	if (vep->state != VEP_START &&
+	    vep->state != VEP_BOM &&
+	    vep->state != VEP_TESTXML &&
+	    vep->state != VEP_NOTXML &&
+	    vep->state != VEP_NEXTTAG) {
+		vep_error(vep, "VEP ended inside a tag");
+	}
+
 	if (vep->o_pending)
 		vep_mark_common(vep, vep->ver_p, vep->last_mark);
 	if (vep->o_wait > 0) {



More information about the varnish-commit mailing list