https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8c726ae0d23c9c02144b22...
commit 8c726ae0d23c9c02144b22a3706a100b3ae08c93 Author: Stanislav Motylkov x86corez@gmail.com AuthorDate: Thu May 24 00:31:20 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Wed May 23 23:40:28 2018 +0200
[MSPAINT] Fix divide by zero in drawZoomFrame
CORE-14539 #resolve --- base/applications/mspaint/imgarea.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/base/applications/mspaint/imgarea.cpp b/base/applications/mspaint/imgarea.cpp index c9b1b3f49e..433fc7b04a 100644 --- a/base/applications/mspaint/imgarea.cpp +++ b/base/applications/mspaint/imgarea.cpp @@ -41,8 +41,14 @@ void CImgAreaWindow::drawZoomFrame(int mouseX, int mouseY) int x, y, w, h; scrollboxWindow.GetClientRect(&clientRectScrollbox); GetClientRect(&clientRectImageArea); - w = clientRectImageArea.right * clientRectScrollbox.right / (clientRectImageArea.right * 2); - h = clientRectImageArea.bottom * clientRectScrollbox.bottom / (clientRectImageArea.bottom * 2); + w = clientRectImageArea.right * 2; + h = clientRectImageArea.bottom * 2; + if (!w || !h) + { + return; + } + w = clientRectImageArea.right * clientRectScrollbox.right / w; + h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h; x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)); y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2));