diff options
author | Jason Molenda <jmolenda@apple.com> | 2015-07-14 19:19:07 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2015-07-14 19:19:07 +0000 |
commit | cb83f5f9284e9d3efa579d8ee7c636ba6ad5e1e9 (patch) | |
tree | 07109d13b86e0c5db258b51dd0f23366351b65de | |
parent | 6bd1aa278a00bffe742725721024d534a98f2b70 (diff) |
Add comment explaning sanity check on packet size in the packet decompression method.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@242184 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index ce0e806d4..9c263c8c4 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -564,8 +564,12 @@ GDBRemoteCommunication::DecompressPacket () return true; size_t pkt_size = m_bytes.size(); + + // Smallest possible compressed packet is $N#00 - an uncompressed empty reply, most commonly indicating + // an unsupported packet. Anything less than 5 characters, it's definitely not a compressed packet. if (pkt_size < 5) return true; + if (m_bytes[0] != '$' && m_bytes[0] != '%') return true; if (m_bytes[1] != 'C' && m_bytes[1] != 'N') |