diff options
author | Patrick Luby <plubius@neooffice.org> | 2023-01-09 18:00:11 -0500 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-10 06:53:53 +0000 |
commit | d96c98647511b6c1f1d1d9a969df39f859cc0696 (patch) | |
tree | 381878acd8b1db61f66fb0af1d9ffbfe3022a904 /vcl | |
parent | 894efac210a3871214d95a52c322b0bee40f00ba (diff) |
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>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/osx/a11ytablewrapper.mm | 23 |
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 |