Opened 12 years ago

Closed 12 years ago

#5186 closed Bugs (duplicate)

uuid process_characters problem

Reported by: Chris Jefferson Owned by: Andy Tompkins
Milestone: To Be Determined Component: uuid
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

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.

Change History (1)

comment:1 by Marshall Clow, 12 years ago

Resolution: duplicate
Status: newclosed

This is a duplicate of ticket #5145

Note: See TracTickets for help on using tickets.