From fee02414cbda2572233bc1cc3217156723108372 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 7 Aug 2018 11:40:15 +0100 Subject: [PATCH] Don't resize to negative size if reading length fails for any reason --- renderdoc/android/jdwp_util.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/renderdoc/android/jdwp_util.cpp b/renderdoc/android/jdwp_util.cpp index 8c2f06ea5..be6c50278 100644 --- a/renderdoc/android/jdwp_util.cpp +++ b/renderdoc/android/jdwp_util.cpp @@ -82,8 +82,11 @@ void Command::Recv(StreamReader &reader) } data.clear(); - data.resize(length - 11); - reader.Read(&data[0], data.size()); + if(length >= 11) + { + data.resize(length - 11); + reader.Read(&data[0], data.size()); + } } CommandData Command::GetData()