[tor-bugs] #6877 [Core Tor/Tor]: Finally replace all char[] buffers with uint8_t[] buffers

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun May 28 15:43:33 UTC 2017


#6877: Finally replace all char[] buffers with uint8_t[] buffers
-------------------------------------------------+-------------------------
 Reporter:  nickm                                |          Owner:
     Type:  defect                               |         Status:  new
 Priority:  High                                 |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-client tor-relay refactoring     |  Actual Points:
  technical-debt lots-of-work                    |
Parent ID:                                       |         Points:  10
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by catalyst):

 Replying to [comment:26 cypherpunks]:
 > Replying to [comment:24 catalyst]:
 > > uint8_t is required by C99 to have no padding bits so the existence of
 uint8_t implies CHAR_BIT==8.  The highly improbable condition to test for
 is that CHAR_BIT==8 and uint8_t exists, but uint8_t is a type (e.g., an
 extended integer type) that's distinct from unsigned char.
 > I don't think you can make that implication because (as you state)
 uint8_t is a distinct type.

 No, I said that it is highly improbable that uint8_t is a type distinct
 from unsigned char on POSIX platforms, and that we should check for that
 case.

 C99 requires the absence of padding bits in uint8_t (and in all of the
 exactly-sized integer types in stdint.h).  If a platform has uint8_t, then
 CHAR_BIT must be 8, because otherwise uint8_t would have padding bits.
 This is true regardless of whether uint8_t is a character type or some
 (implementation-defined) extended integer type.

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


More information about the tor-bugs mailing list