[master] dd8606491 vbt: Check vsb before using it

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jun 10 12:15:07 UTC 2024


commit dd860649179011cd9ac2e48c7af4e1e9385a15ad
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Jun 6 13:42:20 2024 +0200

    vbt: Check vsb before using it

diff --git a/lib/libvarnish/vbt.c b/lib/libvarnish/vbt.c
index f68906e51..c38227a88 100644
--- a/lib/libvarnish/vbt.c
+++ b/lib/libvarnish/vbt.c
@@ -27,6 +27,9 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * We tend to print back-traces when there is a fatal error, so the VBT code
+ * should avoid assertions.
  */
 
 #include "config.h"
@@ -48,6 +51,8 @@
 #include "vbt.h"
 #include "vsb.h"
 
+#include "miniobj.h"
+
 #ifdef WITH_UNWIND
 static int
 vbt_unwind(struct vsb *vsb)
@@ -138,6 +143,8 @@ void
 VBT_format(struct vsb *vsb)
 {
 
+	if (!VALID_OBJ(vsb, VSB_MAGIC))
+		return;
 #ifdef WITH_UNWIND
 	if (!vbt_unwind(vsb))
 		return;


More information about the varnish-commit mailing list