[master] f91c6f9 check for overrun before looking at the next vsm record

Nils Goroll nils.goroll at uplex.de
Wed May 11 14:54:06 CEST 2016


commit f91c6f9025bd2f8faf0e45542e21a4119f33c7c2
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed May 11 14:47:10 2016 +0200

    check for overrun before looking at the next vsm record
    
    Fixes #1873

diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index e9daab0..33d08e3 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -126,6 +126,10 @@ vslc_vsm_next(const struct VSL_cursor *cursor)
 	CHECK_OBJ_NOTNULL(c->vsm, VSM_MAGIC);
 
 	while (1) {
+		i = vslc_vsm_check(&c->cursor, &c->next);
+		if (i <= 0)
+			return (-3); /* Overrun */
+
 		t = *(volatile const uint32_t *)c->next.ptr;
 		AN(t);
 
@@ -147,10 +151,6 @@ vslc_vsm_next(const struct VSL_cursor *cursor)
 			return (0);	/* No new records available */
 		}
 
-		i = vslc_vsm_check(&c->cursor, &c->next);
-		if (i <= 0)
-			return (-3); /* Overrun */
-
 		c->cursor.rec = c->next;
 		c->next.ptr = VSL_NEXT(c->next.ptr);
 



More information about the varnish-commit mailing list