[Boost-bugs] [Boost C++ Libraries] #5186: uuid process_characters problem

Subject: [Boost-bugs] [Boost C++ Libraries] #5186: uuid process_characters problem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-02-13 23:15:33


#5186: uuid process_characters problem
------------------------------+---------------------------------------------
 Reporter: chrisj | Owner: atompkins
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: uuid
  Version: Boost 1.45.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 In boost/uuid/name_generator.hpp, there is the method:

     void process_characters(char_type const*const characters, size_t
 count) {
         BOOST_ASSERT(sizeof(uint32_t) >= sizeof(char_type));

         for (size_t i=0; i<count; i++) {
             uint32_t c = characters[i];
             sha.process_byte( (c >> 0) && 0xFF );
             sha.process_byte( (c >> 8) && 0xFF );
             sha.process_byte( (c >> 16) && 0xFF );
             sha.process_byte( (c >> 24) && 0xFF );
         }
     }

 The usage of ' && 0xFF ' means that all these lines just evaluate to '1',
 meaning all this really does is create a hash of the length of the string,
 except if there are any embedded NULLs in the strings.

 There is an obvious fix, which is to change && to &. However, this would
 obviously change the strings which are generated.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5186>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC