[Lldb-commits] [PATCH] D80755: Support build-ids of other sizes than 16 in UUID::SetFromStringRef

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 2 09:52:34 PDT 2020


friss added inline comments.


================
Comment at: lldb/source/Utility/UUID.cpp:66-67
   uuid_bytes.clear();
   while (!p.empty()) {
-    if (isxdigit(p[0]) && isxdigit(p[1])) {
+    if (p.size() >= 2 && isxdigit(p[0]) && isxdigit(p[1])) {
       int hi_nibble = xdigit_to_int(p[0]);
----------------
labath wrote:
> I guess now obsoletes Fred's D80807.
> 
> (Btw, I actually liked how Fred's solution rejects strings which end in a trailing dash.)
Yeah, I didn't have a strong opinion before, but given we want to reject a buffer that isn't parsed completely, I think it's better to reject a buffer ending with a `-`. As the code would test `p.size()` anyway, we might as well use `p.size() >= 2 ` as the loop condition.

Otherwise this LGTM. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80755/new/

https://reviews.llvm.org/D80755





More information about the lldb-commits mailing list