diff options
author | Sebastien Hertz <shertz@google.com> | 2014-03-18 12:19:52 +0100 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2014-03-18 16:56:07 +0100 |
commit | 43c8d729556844d1a74449a8a300c795d6a5406a (patch) | |
tree | d163695ff0efc74429653587c116d179228fd26d /runtime/jdwp/jdwp_priv.h | |
parent | 341a84af890a328a6c8f719beb3f670dd1a369b4 (diff) | |
download | art-43c8d729556844d1a74449a8a300c795d6a5406a.tar.gz art-43c8d729556844d1a74449a8a300c795d6a5406a.tar.bz2 art-43c8d729556844d1a74449a8a300c795d6a5406a.zip |
Do not send JDWP data in case of error.
When sending JDWP reply packet with an error, we want to ignore any data in the
buffer. While we reflect that in the packet's length (first 4 bytes), we used
to send all data in the buffer. This causes the receiver to read malformed JDWP
packet.
This CL adds "length" argument to JdwpNetStateBase::WritePacket so we control
the amount of data we send. If the reply has no error, it is set to the length
of the buffer. Otherwise it is the length of JDWP packet header indicating no
data is available.
Bug: 13366758
Change-Id: Ib72c10d5faf065fb44901c34b2732496b6667efa
Diffstat (limited to 'runtime/jdwp/jdwp_priv.h')
-rw-r--r-- | runtime/jdwp/jdwp_priv.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/jdwp/jdwp_priv.h b/runtime/jdwp/jdwp_priv.h index 4e6aadac1a..29ad18528d 100644 --- a/runtime/jdwp/jdwp_priv.h +++ b/runtime/jdwp/jdwp_priv.h @@ -69,8 +69,8 @@ class JdwpNetStateBase { void Close(); - ssize_t WritePacket(ExpandBuf* pReply); - ssize_t WriteBufferedPacket(const std::vector<iovec>& iov); + ssize_t WritePacket(ExpandBuf* pReply, size_t length) LOCKS_EXCLUDED(socket_lock_); + ssize_t WriteBufferedPacket(const std::vector<iovec>& iov) LOCKS_EXCLUDED(socket_lock_); int clientSock; // Active connection to debugger. |