From 1663c19834fbff0b9bddfaa7f353c9a1e0589739 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 29 Jan 2020 21:06:35 +0100 Subject: vcl: fix UB in vcl::Cursor::ImplDoShow() pWindow->mpWindowImpl can be nullptr here, see online.git's unit-load-torture test: vcl/source/window/cursor.cxx:204:54: runtime error: member access within null pointer of type 'WindowImpl' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior vcl/source/window/cursor.cxx:204:54 in (And one more similar case in Window::ImplGrabFocus().) (cherry picked from commit f12fc2d07e6f2e9d33ad9350b1f005cbcbe72a18) Conflicts: vcl/source/window/cursor.cxx Change-Id: Idd145082b58c10139be53e9b997efedeb0cec364 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107597 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna --- vcl/source/window/mouse.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 01adba1a2b80..47116725856f 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -313,7 +313,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags ) pSVData->mpWinData->mpFocusWin = this; - if ( pOldFocusWindow ) + if ( pOldFocusWindow && pOldFocusWindow->mpWindowImpl ) { // Cursor hidden if ( pOldFocusWindow->mpWindowImpl->mpCursor ) -- cgit