summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/a11y/atklistener.cxx7
-rw-r--r--vcl/unx/gtk3/a11y/atkselection.cxx14
-rw-r--r--vcl/unx/gtk3/a11y/atktable.cxx15
-rw-r--r--vcl/unx/gtk3/a11y/atkutil.cxx5
-rw-r--r--vcl/unx/gtk3/a11y/atkwrapper.cxx21
5 files changed, 51 insertions, 11 deletions
diff --git a/vcl/unx/gtk3/a11y/atklistener.cxx b/vcl/unx/gtk3/a11y/atklistener.cxx
index 600bb2273881..98cbfab3a2cd 100644
--- a/vcl/unx/gtk3/a11y/atklistener.cxx
+++ b/vcl/unx/gtk3/a11y/atklistener.cxx
@@ -145,9 +145,10 @@ void AtkListener::updateChildList(
}
else
{
- sal_Int32 nChildren = pContext->getAccessibleChildCount();
+ sal_Int64 nChildren = pContext->getAccessibleChildCount();
+ assert(o3tl::make_unsigned(nChildren) < m_aChildList.max_size());
m_aChildList.resize(nChildren);
- for(sal_Int32 n = 0; n < nChildren; n++)
+ for(sal_Int64 n = 0; n < nChildren; n++)
{
try
{
@@ -155,7 +156,7 @@ void AtkListener::updateChildList(
}
catch (lang::IndexOutOfBoundsException const&)
{
- sal_Int32 nChildren2 = pContext->getAccessibleChildCount();
+ sal_Int64 nChildren2 = pContext->getAccessibleChildCount();
assert(nChildren2 <= n && "consistency?");
m_aChildList.resize(std::min(nChildren2, n));
break;
diff --git a/vcl/unx/gtk3/a11y/atkselection.cxx b/vcl/unx/gtk3/a11y/atkselection.cxx
index 6b64c25f4fee..0e74f1c295f4 100644
--- a/vcl/unx/gtk3/a11y/atkselection.cxx
+++ b/vcl/unx/gtk3/a11y/atkselection.cxx
@@ -20,6 +20,7 @@
#include "atkwrapper.hxx"
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <sal/log.hxx>
using namespace ::com::sun::star;
@@ -106,7 +107,16 @@ selection_get_selection_count( AtkSelection *selection)
css::uno::Reference<css::accessibility::XAccessibleSelection> pSelection
= getSelection( selection );
if( pSelection.is() )
- return pSelection->getSelectedAccessibleChildCount();
+ {
+ sal_Int64 nSelected = pSelection->getSelectedAccessibleChildCount();
+ if (nSelected > std::numeric_limits<gint>::max())
+ {
+ SAL_WARN("vcl.gtk", "selection_get_selection_count: Count exceeds maximum gint value, "
+ "using max gint.");
+ nSelected = std::numeric_limits<gint>::max();
+ }
+ return nSelected;
+ }
}
catch(const uno::Exception&) {
g_warning( "Exception in getSelectedAccessibleChildCount()" );
@@ -146,7 +156,7 @@ selection_remove_selection( AtkSelection *selection,
return false;
css::uno::Reference<css::accessibility::XAccessibleContext> xAccContext = xAcc->getAccessibleContext();
- const sal_Int32 nChildIndex = xAccContext->getAccessibleIndexInParent();
+ const sal_Int64 nChildIndex = xAccContext->getAccessibleIndexInParent();
pSelection->deselectAccessibleChild(nChildIndex);
return true;
}
diff --git a/vcl/unx/gtk3/a11y/atktable.cxx b/vcl/unx/gtk3/a11y/atktable.cxx
index 04e9d7645cc5..021f3c19c42c 100644
--- a/vcl/unx/gtk3/a11y/atktable.cxx
+++ b/vcl/unx/gtk3/a11y/atktable.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
#include <comphelper/sequence.hxx>
+#include <sal/log.hxx>
using namespace ::com::sun::star;
@@ -122,7 +123,19 @@ table_wrapper_get_index_at (AtkTable *table,
css::uno::Reference<css::accessibility::XAccessibleTable> pTable
= getTable( table );
if( pTable.is() )
- return pTable->getAccessibleIndex( row, column );
+ {
+ sal_Int64 nIndex = pTable->getAccessibleIndex( row, column );
+ if (nIndex > std::numeric_limits<gint>::max())
+ {
+ // use -2 when the child index is too large to fit into 32 bit to neither use the
+ // valid index of another cell nor -1, which might easily be interpreted as the cell
+ // not/no longer being valid
+ SAL_WARN("vcl.gtk", "table_wrapper_get_index_at: Child index exceeds maximum gint value, "
+ "returning -2.");
+ nIndex = -2;
+ }
+ return nIndex;
+ }
}
catch(const uno::Exception&) {
g_warning( "Exception in getAccessibleIndex()" );
diff --git a/vcl/unx/gtk3/a11y/atkutil.cxx b/vcl/unx/gtk3/a11y/atkutil.cxx
index ed93b842a9c8..d57818f2d40f 100644
--- a/vcl/unx/gtk3/a11y/atkutil.cxx
+++ b/vcl/unx/gtk3/a11y/atkutil.cxx
@@ -257,7 +257,7 @@ void DocumentFocusListener::attachRecursive(
if( ! (nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
{
- sal_Int32 n, nmax = xContext->getAccessibleChildCount();
+ sal_Int64 n, nmax = xContext->getAccessibleChildCount();
for( n = 0; n < nmax; n++ )
{
uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
@@ -308,7 +308,7 @@ void DocumentFocusListener::detachRecursive(
if( ! (nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
{
- sal_Int32 n, nmax = xContext->getAccessibleChildCount();
+ sal_Int64 n, nmax = xContext->getAccessibleChildCount();
for( n = 0; n < nmax; n++ )
{
uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
@@ -363,7 +363,6 @@ static void notify_toolbox_item_focus(ToolBox *pToolBox)
ToolBox::ImplToolItems::size_type nPos = pToolBox->GetItemPos( pToolBox->GetHighlightItemId() );
if( nPos != ToolBox::ITEM_NOTFOUND )
atk_wrapper_focus_tracker_notify_when_idle( xContext->getAccessibleChild( nPos ) );
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32
}
static void handle_toolbox_highlight(vcl::Window *pWindow)
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index c99290fd4a9a..e2aa2c210dd5 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -449,7 +449,14 @@ wrapper_get_n_children( AtkObject *atk_obj )
if( obj->mpContext.is() )
{
try {
- n = obj->mpContext->getAccessibleChildCount();
+ sal_Int64 nChildCount = obj->mpContext->getAccessibleChildCount();
+ if (nChildCount > std::numeric_limits<gint>::max())
+ {
+ SAL_WARN("vcl.gtk", "wrapper_get_n_children: Child count exceeds maximum gint value, "
+ "returning max gint.");
+ nChildCount = std::numeric_limits<gint>::max();
+ }
+ n = nChildCount;
}
catch(const uno::Exception&) {
TOOLS_WARN_EXCEPTION( "vcl", "Exception" );
@@ -514,7 +521,17 @@ wrapper_get_index_in_parent( AtkObject *atk_obj )
if( obj->mpContext.is() )
{
try {
- i = obj->mpContext->getAccessibleIndexInParent();
+ sal_Int64 nIndex = obj->mpContext->getAccessibleIndexInParent();
+ if (nIndex > std::numeric_limits<gint>::max())
+ {
+ // use -2 when the child index is too large to fit into 32 bit to neither use the
+ // valid index of another child nor -1, which would e.g. make Orca interpret the
+ // object as being a zombie
+ SAL_WARN("vcl.gtk", "wrapper_get_index_in_parent: Child index exceeds maximum gint value, "
+ "returning -2.");
+ nIndex = -2;
+ }
+ i = nIndex;
}
catch(const uno::Exception&) {
g_warning( "Exception in getAccessibleIndexInParent()" );