[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #22221 [Core Tor/Tor]: CID 1405983 test_channelpadding.c dead code



#22221: CID 1405983 test_channelpadding.c dead code
------------------------------+--------------------------------
     Reporter:  catalyst      |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.3.1.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 Coverity found this dead code in `test_channelpadding.c` recently.  It
 looks like the `CHANNELS_TO_TEST/3` loop never runs because the
 `CHANNELS_TO_TEST/2` loop runs before it?  Is the right thing to do here
 to switch the sequence of those two loops?

 {{{

 299    /* This loop should add timers to the first position in the
 timerslot
 300     * array, since its timeout is before all other timers. */
         at_least: At condition i < 33, the value of i must be at least 50.
         dead_error_condition: The condition i < 33 cannot be true.
 301    for (; i < CHANNELS_TO_TEST/3; i++) {

 CID 1405983 (#1 of 1): Logically dead code (DEADCODE)
 dead_error_begin: Execution cannot reach this statement:
 chans[i]->next_padding_time....
 302      chans[i]->next_padding_time_ms = monotime_coarse_absolute_msec()
 + 1;
 303      decision = channelpadding_decide_to_pad_channel(chans[i]);
 304      tt_int_op(decision, OP_EQ, CHANNELPADDING_PADDING_SCHEDULED);
 305      tt_assert(chans[i]->pending_padding_callback);
 306      tt_int_op(tried_to_write_cell, OP_EQ, 0);
 307    }}}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/22221>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs