From 4232ef59b4b81a9f5e87f8c90477bac7e85a8cd6 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 9 Jun 2018 18:26:09 -0700 Subject: [PATCH] Debugger: Fix bounds warnings in debug mode. Technically these were accessing outside the container. --- Windows/GEDebugger/TabState.cpp | 2 +- ext/native/net/websocket_server.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Windows/GEDebugger/TabState.cpp b/Windows/GEDebugger/TabState.cpp index 20ea2cdc3a..494cf3e999 100644 --- a/Windows/GEDebugger/TabState.cpp +++ b/Windows/GEDebugger/TabState.cpp @@ -880,7 +880,7 @@ void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) { SetMenuDefaultItem(subMenu, ID_REGLIST_CHANGE, FALSE); // Ehh, kinda ugly. - if (rows_ == &watchList[0]) { + if (!watchList.empty() && rows_ == &watchList[0]) { ModifyMenu(subMenu, ID_GEDBG_WATCH, MF_BYCOMMAND | MF_STRING, ID_GEDBG_WATCH, L"Remove Watch"); } else { ModifyMenu(subMenu, ID_GEDBG_WATCH, MF_BYCOMMAND | MF_STRING, ID_GEDBG_WATCH, L"Add Watch"); diff --git a/ext/native/net/websocket_server.cpp b/ext/native/net/websocket_server.cpp index 40cadfb733..a5fcb81107 100644 --- a/ext/native/net/websocket_server.cpp +++ b/ext/native/net/websocket_server.cpp @@ -526,7 +526,7 @@ void WebSocketServer::SendFlush() { // Drain out as much of our buffer as possible. size_t totalPushed = 0; - while (!outBuf_.empty()) { + while (outBuf_.size() - totalPushed != 0) { size_t pushed = out_->PushAtMost((const char *)&outBuf_[totalPushed], outBuf_.size() - totalPushed); if (pushed == 0) break;