toolkit/source/awt/vclxwindows.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 3aa81e4735ea895a71852b18ed029ae15e53c7b4
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Oct 14 13:10:33 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Oct 14 16:59:13 2024 +0200

    cid#1607242 Overflowed return value
    
    Change-Id: I9efb14bf8395168043e8b3dbe94e7eb84577a175
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174894
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/toolkit/source/awt/vclxwindows.cxx 
b/toolkit/source/awt/vclxwindows.cxx
index 2e3ab973b443..ece671c42592 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -1572,7 +1572,11 @@ sal_Int16 VCLXListBox::getSelectedItemPos()
 {
     SolarMutexGuard aGuard;
     VclPtr< ListBox > pBox = GetAs< ListBox >();
-    return pBox ? pBox->GetSelectedEntryPos() : 0;
+    if (!pBox)
+        return 0;
+    sal_Int32 nPos = pBox->GetSelectedEntryPos();
+    assert(nPos <= SAL_MAX_INT16);
+    return nPos;
 }
 
 css::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos()

Reply via email to