[Libreoffice-commits] .: sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Jul 25 02:12:59 PDT 2011


 sw/source/filter/ww8/ww8par2.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 45f2d2ed3a0f70165cf44434002fc838f60799a6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 25 09:36:05 2011 +0100

    enforce inside bounds

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 79e930d..3fa6a24 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -132,6 +132,11 @@ struct WW8TabBandDesc
     bool bExist[MAX_COL];           // Existiert diese Zelle ?
     sal_uInt8 nTransCell[MAX_COL + 2];  // UEbersetzung WW-Index -> SW-Index
 
+    sal_uInt8 transCell(sal_uInt8 nWwCol) const
+    {
+        return nWwCol < SAL_N_ELEMENTS(nTransCell) ? nTransCell[nWwCol] : 0xFF;
+    }
+
     WW8TabBandDesc();
     WW8TabBandDesc(WW8TabBandDesc& rBand);    // tief kopieren
     ~WW8TabBandDesc();
@@ -2838,7 +2843,9 @@ bool WW8TabDesc::FindMergeGroup(short nX1, short nWidth, bool bExact,
 
 bool WW8TabDesc::IsValidCell(short nCol) const
 {
-    return pActBand->bExist[nCol] && (sal_uInt16)nAktRow < pTabLines->Count();
+    return (static_cast<size_t>(nCol) < SAL_N_ELEMENTS(pActBand->bExist)) &&
+           pActBand->bExist[nCol] &&
+           (sal_uInt16)nAktRow < pTabLines->Count();
 }
 
 bool WW8TabDesc::InFirstParaInCell() const
@@ -2880,7 +2887,7 @@ bool WW8TabDesc::SetPamInCell(short nWwCol, bool bPam)
 {
     OSL_ENSURE( pActBand, "pActBand ist 0" );
 
-    sal_uInt16 nCol = pActBand->nTransCell[nWwCol];
+    sal_uInt16 nCol = pActBand->transCell(nWwCol);
 
     if ((sal_uInt16)nAktRow >= pTabLines->Count())
     {


More information about the Libreoffice-commits mailing list