[tor-bugs] #15554 [Core Tor/Tor]: Put some actual hsdescs in the unit tests for parsing

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Jun 29 14:39:35 UTC 2017


#15554: Put some actual hsdescs in the unit tests for parsing
-------------------------------------------+-------------------------------
 Reporter:  arma                           |          Owner:  rl1987
     Type:  enhancement                    |         Status:
                                           |  needs_revision
 Priority:  Medium                         |      Milestone:  Tor:
                                           |  0.3.2.x-final
Component:  Core Tor/Tor                   |        Version:
 Severity:  Normal                         |     Resolution:
 Keywords:  tor-hs, easy, review-group-19  |  Actual Points:
Parent ID:                                 |         Points:  0.1
 Reviewer:  dgoulet                        |        Sponsor:  SponsorR-can
-------------------------------------------+-------------------------------
Changes (by dgoulet):

 * status:  needs_review => needs_revision
 * reviewer:   => dgoulet
 * points:  small/medium => 0.1


Comment:

 The test fails with:

 {{{
 FAIL src/test/test_hs.c:147: assert(ret OP_EQ 1): 0 vs 1
 }}}

 And in that case, there is a memleak. It's easily fixable with moving the
 `tor_free(desc.desc_str);` before the `tt_int_op()` test.

 The failure is due to:

 {{{
 [warn] parse error: Malformed object: bad begin line
 }}}

 There are many condition to hit that and I narrow it down to
 `strcmp_len(eol-5, "-----", 5)` which returns -32 in our case. So I think
 all those `\r` to the end of the line are not making the parsing function
 happy. If your remove them, it works but then the control port test is
 unhappy.

 *So* we either need to copy is in another const string without the `\r` or
 do some magic removal \r :). I say go with the easy "copy without \r".

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/15554#comment:18>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list