Opened 9 years ago

Closed 5 years ago

#8630 closed Bugs (fixed)

uuid string generator accepts invalid uuids

Reported by: record.nctu.cis91@… Owned by: Andy Tompkins
Milestone: Boost 1.66.0 Component: uuid
Version: Boost 1.53.0 Severity: Problem
Keywords: uuid string generator Cc:

Description

I've tried stream operator and string generator to convert string into uuids.
But the string generator one accepts some incorrect uuid representation.
For example, with the following strings:

  • "0000-0000-0000-0000-000000000000"
  • "------------------------------------"

String generator accepts but produce strange content, but stream operator will refuse them.

Maybe it's better to throw exception in such case?
To tell user such string is not a correct uuid representation.

Change History (3)

comment:1 by anonymous, 8 years ago

I think

char const* d = std::find(digits_begin, digits_end, c);
return values[d - digits_begin];

should be

char const* d = std::find(digits_begin, digits_end, c);
if (d == digits_end)
    throw_invalid();
return values[d - digits_begin];

comment:2 by James E. King, III <jking@…>, 5 years ago

comment:3 by James E. King, III, 5 years ago

Milestone: To Be DeterminedBoost 1.66.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.