vcl/source/accessibility/vclxaccessibletoolbox.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit c4a0af44d7be439a9f6bb90f8bbb542b91d1df72
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Aug 3 21:19:46 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Aug 4 12:35:54 2025 +0200

    cid#1660806 Overflowed integer argument
    
    and
    
    cid#1660802 Overflowed integer argument
    
    Change-Id: I55ef05850ecfefea55bda7f12cca2c07b3a965a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188886
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/accessibility/vclxaccessibletoolbox.cxx 
b/vcl/source/accessibility/vclxaccessibletoolbox.cxx
index cba1b6e20e5c..233234b0dbab 100644
--- a/vcl/source/accessibility/vclxaccessibletoolbox.cxx
+++ b/vcl/source/accessibility/vclxaccessibletoolbox.cxx
@@ -258,10 +258,14 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( 
vcl::Window* pWindow, b
         // Moreover, calling GetItemPos with 0 will find a separator if there 
is any.
         return;
 
+    ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos(nDownItem);
+    if (nIndex == ToolBox::ITEM_NOTFOUND)
+        return; // not found
+
     rtl::Reference<comphelper::OAccessible> pChild = pWindow->GetAccessible();
     if (pChild.is())
     {
-        Reference< XAccessible > xChildItem( 
getAccessibleChild(pToolBox->GetItemPos(nDownItem)));
+        Reference< XAccessible > xChildItem(getAccessibleChild(nIndex));
         VCLXAccessibleToolBoxItem* pItem = static_cast< 
VCLXAccessibleToolBoxItem* >( xChildItem.get() );
 
         pItem->SetChild(pChild);
@@ -299,7 +303,10 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const 
VclWindowEvent& rVclWin
         // Moreover, calling GetItemPos with 0 will find a separator if there 
is any.
         return;
 
-    ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos( 
nCurItemId );
+    ToolBox::ImplToolItems::size_type nIndex = 
pToolBox->GetItemPos(nCurItemId);
+    if (nIndex == ToolBox::ITEM_NOTFOUND)
+        return; // not found
+
     Reference< XAccessible > xItem = getAccessibleChild( nIndex );
     if ( xItem.is() )
     {

Reply via email to