summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Luby <plubius@neooffice.org>2023-01-09 18:00:11 -0500
committerXisco Fauli <xiscofauli@libreoffice.org>2023-01-10 14:49:26 +0000
commit7a7a831809fdcf8a25b907ab7f576cb5210d7b47 (patch)
treeb1cc81418091e607d7da82a11f9ae403f6e221dd
parentdisable Skia as default on Mac for 7.5 (diff)
downloadcore-7a7a831809fdcf8a25b907ab7f576cb5210d7b47.tar.gz
core-7a7a831809fdcf8a25b907ab7f576cb5210d7b47.zip
tdf#152648 Handle overflow when multiplying rows and columns
Change-Id: I1f3b4853fb6e6a66e74e798d6594342c84d5a695 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145245 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit d96c98647511b6c1f1d1d9a969df39f859cc0696) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145228 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--vcl/osx/a11ytablewrapper.mm23
1 files changed, 16 insertions, 7 deletions
diff --git a/vcl/osx/a11ytablewrapper.mm b/vcl/osx/a11ytablewrapper.mm
index 0cd98c7863dd..6f8775f0a4b5 100644
--- a/vcl/osx/a11ytablewrapper.mm
+++ b/vcl/osx/a11ytablewrapper.mm
@@ -39,8 +39,10 @@ using namespace ::com::sun::star::uno;
{
sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
-
- if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+
+ // tdf#152648 Handle overflow when multiplying rows and columns
+ sal_Int64 nCells = static_cast<sal_Int64>(nRows) * static_cast<sal_Int64>(nCols);
+ if( nCells >= 0 && nCells < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
{
// make all children visible to the hierarchy
for ( sal_Int32 rowCount = 0; rowCount < nRows; rowCount++ )
@@ -111,9 +113,10 @@ using namespace ::com::sun::star::uno;
{
sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
-
-
- if( nRows*nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+
+ // tdf#152648 Handle overflow when multiplying rows and columns
+ sal_Int64 nCells = static_cast<sal_Int64>(nRows) * static_cast<sal_Int64>(nCols);
+ if( nCells >= 0 && nCells < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
{
[ attributeNames addObject: NSAccessibilityRowsAttribute ];
[ attributeNames addObject: NSAccessibilityColumnsAttribute ];
@@ -130,7 +133,10 @@ using namespace ::com::sun::star::uno;
{
sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
- if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+
+ // tdf#152648 Handle overflow when multiplying rows and columns
+ sal_Int64 nCells = static_cast<sal_Int64>(nRows) * static_cast<sal_Int64>(nCols);
+ if( nCells >= 0 && nCells < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
{
NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
try
@@ -168,7 +174,10 @@ using namespace ::com::sun::star::uno;
{
sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
- if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+
+ // tdf#152648 Handle overflow when multiplying rows and columns
+ sal_Int64 nCells = static_cast<sal_Int64>(nRows) * static_cast<sal_Int64>(nCols);
+ if( nCells >= 0 && nCells < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
{
NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
try