[Lldb-commits] [PATCH] D76736: [LLDB] Fix parsing of IPv6 host:port inside brackets

Emre Kultursay via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 24 15:39:50 PDT 2020


emrekultursay created this revision.
emrekultursay added a reviewer: LLDB.
Herald added a project: LLDB.

When using IPv6 host:port pairs, typically the host is put inside
brackets, such as [2601:1234:...:0213]:5555, and the UriParser
can handle this format.

However, the Android infrastructure in LLDB assumes an additional
brackets around the host:port pair, such that the entire host:port
string can be treated as the host (which is used as an Android Serial
Number), and UriParser cannot handle multiple brackets. Parsing
inputs with such extra backets requires searching the closing bracket
from the right.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76736

Files:
  lldb/source/Utility/UriParser.cpp


Index: lldb/source/Utility/UriParser.cpp
===================================================================
--- lldb/source/Utility/UriParser.cpp
+++ lldb/source/Utility/UriParser.cpp
@@ -42,7 +42,7 @@
   // Extract hostname
   if (!host_port.empty() && host_port[0] == '[') {
     // hostname is enclosed with square brackets.
-    pos = host_port.find(']');
+    pos = host_port.rfind(']');
     if (pos == std::string::npos)
       return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76736.252441.patch
Type: text/x-patch
Size: 452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200324/a5ea9e8c/attachment.bin>


More information about the lldb-commits mailing list