[tor-bugs] #21872 [Core Tor/Tor]: encoded length macros for baseXX encodings

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue May 16 23:13:25 UTC 2017


#21872: encoded length macros for baseXX encodings
--------------------------+------------------------------------
 Reporter:  catalyst      |          Owner:  catalyst
     Type:  enhancement   |         Status:  reopened
 Priority:  Medium        |      Milestone:  Tor: 0.3.1.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  util          |  Actual Points:
Parent ID:  #19531        |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------
Changes (by Jigsaw52):

 * status:  closed => reopened
 * resolution:  implemented =>


Comment:

 I found a bug on these macro definitions while working on #7869:

 If you look closely at the following macros:

 {{{
 #define BASE64_NOPAD_LEN(n) (CEIL_DIV((n) * 4, 3)
 #define BASE32_NOPAD_LEN(n) (CEIL_DIV((n) * 8, 5)

 #define BASE64_NOPAD_BUFSIZE(n) (BASE64_NOPAD_LEN(n) + 1))
 #define BASE32_NOPAD_BUFSIZE(n) (BASE32_NOPAD_LEN(n) + 1))
 }}}

 You will notice that BASE64_NOPAD_LEN and BASE32_NOPAD_LEN are missing the
 closing parentheses.
 Also, BASE64_NOPAD_BUFSIZE and BASE32_NOPAD_BUFSIZE have one extra closing
 parentheses.
 If you use only BASE64_NOPAD_BUFSIZE and BASE32_NOPAD_BUFSIZE everything
 will be fine as both errors cancel each other out.

 Here is my fix: https://github.com/Jigsaw52/tor/tree/baseXX-macro-
 fix-21872

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


More information about the tor-bugs mailing list