Boost C++ Libraries: Ticket #12253: UUID Valid String Semantics are Erratic https://svn.boost.org/trac10/ticket/12253 <p> In boost/uuid/string_generator.hpp unsigned char get_value(char c) const, the hex characters <a class="missing changeset" title="No changeset 0123456789abcdefABCDEF in the repository">[0123456789abcdefABCDEF]</a> are handled explicitly, and any other character is treated as 0xFF (255). However, from line 89 (within operator()), if there is a dash in the ninth character, but not in the fourteenth, etc., throw_invalid is called. That means that the uuid "Have a great big roast-beef sandwich!" will not throw, but "01234567-89abcdef-0123-456789abcdef" will. </p> <p> Instead of allowing most invalid characters (excepting dashes and lack of braces in certain positions), we should disallow anything but the standard hex digits as digits. Besides the brace and dash handling as it currently is, only <a class="missing changeset" title="No changeset 0123456789abcdefABCDEF in the repository">[0123456789abcdefABCDEF]</a> should be allowed. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12253 Trac 1.4.3 Michel Morin Sat, 11 Jun 2016 17:23:43 GMT component changed; owner set https://svn.boost.org/trac10/ticket/12253#comment:1 https://svn.boost.org/trac10/ticket/12253#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Andy Tompkins</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">uuid</span> </li> </ul> Ticket jim.king@… Thu, 20 Jul 2017 18:49:56 GMT <link>https://svn.boost.org/trac10/ticket/12253#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12253#comment:2</guid> <description> <p> I can confirm this behavior in boost 1.62 as well: </p> <pre class="wiki"> //! Convert a string to a GUID inline GUID stog(const std::string&amp; gs) { BOOST_STATIC_ASSERT(sizeof(GUID) == sizeof(boost::uuids::uuid)); GUID result; memcpy(&amp;result, boost::uuids::string_generator()(gs).data, sizeof(GUID)); return result; } </pre><p> Sitting in the debugger, we see I passed in an invalid uuid string but I got back a GUID that has FFFF in place of the "zzzz" I put in there: </p> <pre class="wiki">+ gs "83f8638b-8dca-4152-zzzz-2ca8b33039b4" const + &amp;result 0x0000005305f9ed38 {8B63F883-CA8D-5241-FFFF-2CA8B33039B4} _GUID * </pre><p> I would also like to see the parser here changed to be much more strict. </p> </description> <category>Ticket</category> </item> <item> <author>James E. King, III <jking@…></author> <pubDate>Thu, 03 Aug 2017 17:59:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12253#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12253#comment:3</guid> <description> <p> A fix for this can be found in PR <a class="ext-link" href="https://github.com/boostorg/uuid/pull/17/files"><span class="icon">​</span>https://github.com/boostorg/uuid/pull/17/files</a> </p> </description> <category>Ticket</category> </item> <item> <author>James E. King, III <jking@…></author> <pubDate>Fri, 04 Aug 2017 12:26:00 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/12253#comment:4 https://svn.boost.org/trac10/ticket/12253#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.61.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> I changed the milestone from 1.61.0 to "To Be Determined" because it wasn't fixed in 1.61.0 </p> Ticket James E. King, III Sat, 12 Aug 2017 23:11:38 GMT owner changed https://svn.boost.org/trac10/ticket/12253#comment:5 https://svn.boost.org/trac10/ticket/12253#comment:5 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Andy Tompkins</span> to <span class="trac-author">James E. King, III</span> </li> </ul> Ticket James E. King, III Sat, 12 Aug 2017 23:11:49 GMT milestone changed https://svn.boost.org/trac10/ticket/12253#comment:6 https://svn.boost.org/trac10/ticket/12253#comment:6 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.66.0</span> </li> </ul> Ticket James E. King, III Sat, 12 Aug 2017 23:11:58 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12253#comment:7 https://svn.boost.org/trac10/ticket/12253#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket