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

Re: [tor-bugs] #3571 [Pluggable transport]: obfsproxy: Please review portability fixes



#3571: obfsproxy: Please review portability fixes
------------------------------------+---------------------------------------
    Reporter:  zwol                 |       Owner:  asn   
        Type:  enhancement          |      Status:  closed
    Priority:  normal               |   Milestone:        
   Component:  Pluggable transport  |     Version:        
  Resolution:  fixed                |    Keywords:        
      Parent:                       |      Points:        
Actualpoints:                       |  
------------------------------------+---------------------------------------

Comment(by zwol):

 I read carefully through both sides of the merge and didn't see any
 problems.  Also, I've verified that the result still builds and passes
 unit tests on Linux and Windows.

 I did notice a new portability problem introduced on the other side of the
 merge (specifically, with the change that introduced doubly linked lists).

 {{{#define OFFSETOF(container_type, element) \
   (((char*)&((container_type*)0)->element) - ((char*)
 ((container_type*)0)))}}}

 This construct provokes undefined behavior, as it dereferences the null
 pointer (yes, even though that dereference is inside the argument of the
 address-of operator).  Sufficiently aggressive C optimizers can and will
 break it.  (No version of GCC that I have convenient access to actually
 does break it, but I recall its fragility being discussed on the GCC
 mailing lists, and I wouldn't be surprised if clang had a problem with
 it.)  It's also '''completely unnecessary'''.  C89 provides `offsetof`,
 with identical effect, in `<stddef.h>`; the last environment I'm aware of
 that didn't have `<stddef.h>` was the K&R-only compiler bundled with some
 versions of Solaris -- but obfsproxy won't compile with that antique
 anyway.

 I'll send in another patch to get rid of it.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/3571#comment:6>
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