[Varnish] #1202: Test r01036.vtc warns of assertion-failure, but succeeds

Varnish varnish-bugs at varnish-cache.org
Mon Oct 1 18:41:13 CEST 2012


#1202: Test r01036.vtc warns of assertion-failure, but succeeds
-------------------------+--------------------
 Reporter:  mi           |       Owner:
     Type:  defect       |      Status:  new
 Priority:  low          |   Milestone:
Component:  varnishtest  |     Version:  3.0.3
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+--------------------

Comment (by mi):

 Ok, this one proved easy... NLEAD is a defined as an array-dimension
 (sizeof/sizeof), which makes it unsigned. lvl, on the other hand, is
 (signed) integer. When they compared, the int is interpreted to unsigned,
 evidently -- the problem strikes, when lvl is negative (such as -1).

 This patch fixes the assert:

 {{{
 --- bin/varnishtest/vtc_log.c   2012-08-20 05:20:40.000000000 -0400
 +++ bin/varnishtest/vtc_log.c   2012-10-01 12:35:45.000000000 -0400
 @@ -138,5 +138,5 @@
         AZ(pthread_mutex_lock(&vl->mtx));
         vl->act = 1;
 -       assert(lvl < NLEAD);
 +       assert(lvl < (int)NLEAD);
         VSB_clear(vl->vsb);
         VSB_printf(vl->vsb, "%s %-4s %4.1f ",

 }}}

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1202#comment:1>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list