forked from OSchip/llvm-project
Fix an off-by-one in SocketTest::DecodeHostAndPort
65535 is still a valid port. This should fix the android failures we were getting when we chose to connect over 65535 to the remote lldb-server. llvm-svn: 259638
This commit is contained in:
parent
323862e13c
commit
1b58f5cbbb
|
@ -268,7 +268,7 @@ Socket::DecodeHostAndPort(llvm::StringRef host_and_port,
|
|||
{
|
||||
bool ok = false;
|
||||
port = StringConvert::ToUInt32 (port_str.c_str(), UINT32_MAX, 10, &ok);
|
||||
if (ok && port < UINT16_MAX)
|
||||
if (ok && port <= UINT16_MAX)
|
||||
{
|
||||
if (error_ptr)
|
||||
error_ptr->Clear();
|
||||
|
|
|
@ -116,7 +116,11 @@ TEST_F (SocketTest, DecodeHostAndPort)
|
|||
EXPECT_FALSE (Socket::DecodeHostAndPort ("google.com:-1138", host_str, port_str, port, &error));
|
||||
EXPECT_TRUE (error.Fail ());
|
||||
EXPECT_STREQ ("invalid host:port specification: 'google.com:-1138'", error.AsCString ());
|
||||
|
||||
|
||||
EXPECT_FALSE(Socket::DecodeHostAndPort("google.com:65536", host_str, port_str, port, &error));
|
||||
EXPECT_TRUE(error.Fail());
|
||||
EXPECT_STREQ("invalid host:port specification: 'google.com:65536'", error.AsCString());
|
||||
|
||||
EXPECT_TRUE (Socket::DecodeHostAndPort ("12345", host_str, port_str, port, &error));
|
||||
EXPECT_STREQ ("", host_str.c_str ());
|
||||
EXPECT_STREQ ("12345", port_str.c_str ());
|
||||
|
@ -128,6 +132,12 @@ TEST_F (SocketTest, DecodeHostAndPort)
|
|||
EXPECT_STREQ ("0", port_str.c_str ());
|
||||
EXPECT_EQ (0, port);
|
||||
EXPECT_TRUE (error.Success ());
|
||||
|
||||
EXPECT_TRUE(Socket::DecodeHostAndPort("*:65535", host_str, port_str, port, &error));
|
||||
EXPECT_STREQ("*", host_str.c_str());
|
||||
EXPECT_STREQ("65535", port_str.c_str());
|
||||
EXPECT_EQ(65535, port);
|
||||
EXPECT_TRUE(error.Success());
|
||||
}
|
||||
|
||||
#ifndef LLDB_DISABLE_POSIX
|
||||
|
|
Loading…
Reference in New Issue