[Libreoffice-commits] core.git: 4 commits - sc/source sw/source vcl/generic vcl/source

Caolán McNamara caolanm at redhat.com
Sun Nov 30 12:28:53 PST 2014


 sc/source/filter/lotus/lotimpop.cxx |   59 +++++++------
 sc/source/filter/lotus/op.cxx       |  162 ++++++++++++++++++++----------------
 sw/source/core/text/txttab.cxx      |    4 
 vcl/generic/glyphs/scrptrun.cxx     |    6 +
 vcl/generic/glyphs/scrptrun.h       |    4 
 vcl/source/fontsubset/sft.cxx       |    9 +-
 6 files changed, 139 insertions(+), 105 deletions(-)

New commits:
commit 6688e5426435c03edffef75c6cfd3f3033246521
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Nov 30 20:27:36 2014 +0000

    fix higher debug level build
    
    Change-Id: Ic5aae12c6a32c535faf790892810522aa4c527f5

diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 4956a0d..89bf45f 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -510,9 +510,9 @@ void SwTabPortion::Paint( const SwTxtPaintInfo &rInf ) const
         SwViewOption::IsFieldShadings()    )
     {
         const sal_uInt16 nTmpWidth = PrtWidth();
-        static_cast<SwTabPortion*>(this)->PrtWidth( GetFixWidth() );
+        const_cast<SwTabPortion*>(this)->PrtWidth( GetFixWidth() );
         rInf.DrawViewOpt( *this, POR_TAB );
-        static_cast<SwTabPortion*>(this)->PrtWidth( nTmpWidth );
+        const_cast<SwTabPortion*>(this)->PrtWidth( nTmpWidth );
     }
 #endif
 
commit f7527ebddafb769738b75b53742df3b65d074f52
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 29 20:46:43 2014 +0000

    coverity#1242775 Use of untrusted scalar value
    
    and coverity#1242728
    and coverity#1242836
    and coverity#1242927
    and coverity#1242942
    and coverity#1242937
    and coverity#1242793
    and coverity#1242945
    
    move the casts to one single place before they get
    scrutinized
    
    Change-Id: I8a14f8d22b5c38d04f4fb538a1eb0baeef04e390

diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index 7cce192..c5017c9 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -330,16 +330,17 @@ void ImportLotus::RowPresentation( sal_uInt16 nRecLen )
 
 void ImportLotus::NamedSheet( void )
 {
-    sal_uInt16  nLTab;
-    OUString    aName;
+    sal_uInt16 nTmpTab(0);
+    Read(nTmpTab);
+    OUString aName;
+    Read(aName);
 
-    Read( nLTab );
-    Read( aName );
+    SCTAB nLTab(static_cast<SCTAB>(nTmpTab));
 
-    if( pD->HasTable( static_cast<SCTAB> (nLTab) ) )
-        pD->RenameTab( static_cast<SCTAB> (nLTab), aName );
+    if (pD->HasTable(nLTab))
+        pD->RenameTab(nLTab, aName);
     else
-        pD->InsertTab( static_cast<SCTAB> (nLTab), aName );
+        pD->InsertTab(nLTab, aName);
 }
 
 void ImportLotus::Font_Face( void )
@@ -384,8 +385,6 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
 {
     OSL_ENSURE( nExtTab >= 0, "*ImportLotus::_Row(): not possible!" );
 
-    sal_uInt16          nRow;
-    sal_uInt16          nHeight;
     sal_uInt16            nCntDwn = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 5;
     SCCOL           nColCnt = 0;
     sal_uInt8           nRepeats;
@@ -394,14 +393,19 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
     bool            bCenter = false;
     SCCOL           nCenterStart = 0, nCenterEnd = 0;
 
-    Read( nRow );
-    Read( nHeight );
+    sal_uInt16 nTmpRow(0);
+    Read(nTmpRow);
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
+    sal_uInt16 nHeight(0);
+    Read(nHeight);
 
     nHeight &= 0x0FFF;
     nHeight *= 22;
 
+    SCTAB nDestTab(static_cast<SCTAB>(nExtTab));
+
     if( nHeight )
-        pD->SetRowHeight( static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab), nHeight );
+        pD->SetRowHeight(nRow, nDestTab, nHeight);
 
     LotusContext &rContext = aConv.getContext();
     while( nCntDwn )
@@ -411,36 +415,39 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
 
         if( aAttr.HasStyles() )
             rContext.pLotusRoot->pAttrTable->SetAttr(
-                nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), static_cast<SCROW> (nRow), aAttr );
+                nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), nRow, aAttr );
 
         // Do this here and NOT in class LotAttrTable, as we only add attributes if the other
         // attributes are set
         //  -> for Center-Attribute default is centered
         if( aAttr.IsCentered() )
-            {
+        {
             if( bCenter )
+            {
+                if (pD->HasData(nColCnt, nRow, nDestTab))
                 {
-                if( pD->HasData( nColCnt, static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab) ) )
-                    {// new Center after previous Center
-                    pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
+                    // new Center after previous Center
+                    pD->DoMerge(nDestTab, nCenterStart, nRow, nCenterEnd, nRow);
                     nCenterStart = nColCnt;
-                    }
                 }
+            }
             else
-                {// fully new Center
+            {
+                // fully new Center
                 bCenter = true;
                 nCenterStart = nColCnt;
-                }
-            nCenterEnd = nColCnt + static_cast<SCCOL>(nRepeats);
             }
+            nCenterEnd = nColCnt + static_cast<SCCOL>(nRepeats);
+        }
         else
-            {
+        {
             if( bCenter )
-                {// possibly reset old Center
-                pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
+            {
+                // possibly reset old Center
+                pD->DoMerge(nDestTab, nCenterStart, nRow, nCenterEnd, nRow);
                 bCenter = false;
-                }
             }
+        }
 
         nColCnt = nColCnt + static_cast<SCCOL>(nRepeats);
         nColCnt++;
@@ -450,6 +457,6 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
 
     if( bCenter )
         // possibly reset old Center
-        pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
+        pD->DoMerge(nDestTab, nCenterStart, nRow, nCenterEnd, nRow);
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 69ce384..69fa71b 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -73,48 +73,48 @@ void OP_EOF(LotusContext& rContext, SvStream& /*r*/, sal_uInt16 /*n*/)
 void OP_Integer(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 {
     sal_uInt8 nFormat(0);
-    sal_uInt16 nCol(0), nRow(0);
-    SCTAB nTab(0);
+    sal_uInt16 nTmpCol(0), nTmpRow(0);
     sal_Int16 nValue(0);
+    r.ReadUChar(nFormat).ReadUInt16(nTmpCol).ReadUInt16(nTmpRow).ReadInt16(nValue);
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
 
-    r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow ).ReadInt16( nValue );
-
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
+    if (ValidColRow(nCol, nRow))
     {
-        rContext.pDoc->EnsureTable(nTab);
-        rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), static_cast<double>(nValue));
+        rContext.pDoc->EnsureTable(0);
+        rContext.pDoc->SetValue(ScAddress(nCol, nRow, 0), static_cast<double>(nValue));
 
         // 0 decimal places!
-        SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, 0);
+        SetFormat(rContext, nCol, nRow, 0, nFormat, 0);
     }
 }
 
 void OP_Number(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 {
     sal_uInt8 nFormat(0);
-    sal_uInt16 nCol(0), nRow(0);
-    SCTAB nTab(0);
+    sal_uInt16 nTmpCol(0), nTmpRow(0);
     double fValue(0.0);
+    r.ReadUChar( nFormat ).ReadUInt16(nTmpCol).ReadUInt16(nTmpRow).ReadDouble(fValue);
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
 
-    r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow ).ReadDouble( fValue );
-
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
+    if (ValidColRow(nCol, nRow))
     {
         fValue = ::rtl::math::round( fValue, 15 );
-        rContext.pDoc->EnsureTable(nTab);
-        rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), fValue);
+        rContext.pDoc->EnsureTable(0);
+        rContext.pDoc->SetValue(ScAddress(nCol, nRow, 0), fValue);
 
-        SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat);
+        SetFormat(rContext, nCol, nRow, 0, nFormat, nDezFloat);
     }
 }
 
 void OP_Label(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 {
     sal_uInt8 nFormat(0);
-    sal_uInt16 nCol(0), nRow(0);
-    SCTAB nTab(0);
-
-    r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow );
+    sal_uInt16 nTmpCol(0), nTmpRow(0);
+    r.ReadUChar(nFormat).ReadUInt16(nTmpCol).ReadUInt16(nTmpRow);
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
 
     n -= (n > 5) ? 5 : n;
 
@@ -122,68 +122,70 @@ void OP_Label(LotusContext& rContext, SvStream& r, sal_uInt16 n)
     r.Read( pText.get(), n );
     pText[n] = 0;
 
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
+    if (ValidColRow(nCol, nRow))
     {
         nFormat &= 0x80;    // don't change Bit 7
         nFormat |= 0x75;    // protected does not matter, special-text is set
 
-        PutFormString(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pText.get());
+        PutFormString(rContext, nCol, nRow, 0, pText.get());
 
-        SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezStd);
+        SetFormat(rContext, nCol, nRow, 0, nFormat, nDezStd);
     }
 }
 
 void OP_Formula(LotusContext &rContext, SvStream& r, sal_uInt16 /*n*/)
 {
-    sal_uInt8               nFormat;
-    sal_uInt16              nCol, nRow, nFormulaSize;
-    SCTAB                   nTab = 0;
+    sal_uInt8 nFormat(0);
+    sal_uInt16 nTmpCol(0), nTmpRow(0);
+    r.ReadUChar(nFormat).ReadUInt16(nTmpCol).ReadUInt16(nTmpRow);
+    r.SeekRel(8);    // skip result
+    sal_uInt16 nFormulaSize(0);
+    r.ReadUInt16(nFormulaSize);
 
-    r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow );
-    r.SeekRel( 8 );    // skip result
-    r.ReadUInt16( nFormulaSize );
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
 
     const ScTokenArray* pErg;
-    sal_Int32               nBytesLeft = nFormulaSize;
-    ScAddress           aAddress( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab );
+    sal_Int32 nBytesLeft = nFormulaSize;
+    ScAddress aAddress(nCol, nRow, 0);
 
     svl::SharedStringPool& rSPool = rContext.pLotusRoot->pDoc->GetSharedStringPool();
     LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, false);
     aConv.Reset( aAddress );
     aConv.Convert( pErg, nBytesLeft );
 
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
+    if (ValidColRow(nCol, nRow))
     {
         ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg);
         pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
-        rContext.pDoc->EnsureTable(nTab);
-        rContext.pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
+        rContext.pDoc->EnsureTable(0);
+        rContext.pDoc->SetFormulaCell(ScAddress(nCol, nRow, 0), pCell);
 
         // nFormat = Default -> decimal places like Float
-        SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat);
+        SetFormat(rContext, nCol, nRow, 0, nFormat, nDezFloat);
     }
 }
 
 void OP_ColumnWidth(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 {
-    sal_uInt16              nCol, nBreite;
-    sal_uInt8               nWidthSpaces;
-    SCTAB                   nTab = 0;
+    sal_uInt16 nTmpCol(0);
+    sal_uInt8 nWidthSpaces(0);
+    r.ReadUInt16(nTmpCol).ReadUChar(nWidthSpaces);
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
 
-    r.ReadUInt16( nCol ).ReadUChar( nWidthSpaces );
-
-    if (ValidCol( static_cast<SCCOL>(nCol)))
+    if (ValidCol(nCol))
     {
+        sal_uInt16 nBreite;
         if( nWidthSpaces )
             // assuming 10cpi character set
             nBreite = ( sal_uInt16 ) ( TWIPS_PER_CHAR * nWidthSpaces );
         else
         {
-            rContext.pDoc->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), 0, true);
+            rContext.pDoc->SetColHidden(nCol, nCol, 0, true);
             nBreite = nDefWidth;
         }
 
-        rContext.pDoc->SetColWidth( static_cast<SCCOL> (nCol), nTab, nBreite );
+        rContext.pDoc->SetColWidth(nCol, 0, nBreite);
     }
 }
 
@@ -323,11 +325,13 @@ void OP_Window1(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 
 void OP_Blank(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 {
-    sal_uInt16      nCol, nRow;
-    sal_uInt8       nFormat;
-    r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow );
+    sal_uInt8 nFormat(0);
+    sal_uInt16 nTmpCol(0), nTmpRow(0);
+    r.ReadUChar( nFormat ).ReadUInt16(nTmpCol).ReadUInt16(nTmpRow);
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
 
-    SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), 0, nFormat, nDezFloat);
+    SetFormat(rContext, nCol, nRow, 0, nFormat, nDezFloat);
 }
 
 void OP_BOF123(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 /*n*/)
@@ -342,27 +346,33 @@ void OP_EOF123(LotusContext& rContext, SvStream& /*r*/, sal_uInt16 /*n*/)
 
 void OP_Label123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 {
-    sal_uInt8      nTab, nCol;
-    sal_uInt16    nRow;
-    r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol );
+    sal_uInt8 nTmpTab(0), nTmpCol(0);
+    sal_uInt16 nTmpRow(0);
+    r.ReadUInt16(nTmpRow).ReadUChar(nTmpTab).ReadUChar(nTmpCol);
+    SCTAB nTab(static_cast<SCTAB>(nTmpTab));
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
+
     n -= (n > 4) ? 4 : n;
 
     boost::scoped_array<sal_Char> pText(new sal_Char[n + 1]);
     r.Read( pText.get(), n );
     pText[ n ] = 0;
 
-    PutFormString(rContext, static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pText.get());
+    PutFormString(rContext, nCol, nRow, nTab, pText.get());
 }
 
 void OP_Number123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 {
-    sal_uInt8 nCol(0), nTab(0);
-    sal_uInt16 nRow(0);
+    sal_uInt16 nTmpRow(0);
+    sal_uInt8 nTmpCol(0), nTmpTab(0);
     sal_uInt32 nValue(0);
+    r.ReadUInt16(nTmpRow).ReadUChar(nTmpTab).ReadUChar(nTmpCol).ReadUInt32(nValue);
+    SCTAB nTab(static_cast<SCTAB>(nTmpTab));
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
 
-    r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol ).ReadUInt32( nValue );
-
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
+    if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
     {
         double fValue = Snum32ToDouble( nValue );
         rContext.pDoc->EnsureTable(nTab);
@@ -372,10 +382,12 @@ void OP_Number123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 
 void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 {
-    sal_uInt8 nCol(0), nTab(0);
-    sal_uInt16 nRow(0);
-
-    r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol );
+    sal_uInt16 nTmpRow(0);
+    sal_uInt8 nTmpCol(0), nTmpTab(0);
+    r.ReadUInt16(nTmpRow).ReadUChar(nTmpTab).ReadUChar(nTmpCol);
+    SCTAB nTab(static_cast<SCTAB>(nTmpTab));
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
     r.SeekRel( 8 );    // skip Result
 
     const ScTokenArray* pErg;
@@ -387,7 +399,7 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
     aConv.Reset( aAddress );
     aConv.Convert( pErg, nBytesLeft );
 
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
+    if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
     {
         ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg);
         pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
@@ -398,13 +410,15 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 
 void OP_IEEENumber123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 {
-    sal_uInt8 nCol,nTab;
-    sal_uInt16 nRow;
-    double dValue;
-
-    r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol ).ReadDouble( dValue );
-
-    if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
+    sal_uInt16 nTmpRow(0);
+    sal_uInt8 nTmpCol(0), nTmpTab(0);
+    double dValue(0.0);
+    r.ReadUInt16(nTmpRow).ReadUChar(nTmpTab).ReadUChar(nTmpCol).ReadDouble(dValue);
+    SCTAB nTab(static_cast<SCTAB>(nTmpTab));
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
+
+    if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
     {
         rContext.pDoc->EnsureTable(nTab);
         rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), dValue);
@@ -413,9 +427,13 @@ void OP_IEEENumber123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 
 void OP_Note123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 {
-    sal_uInt8 nTab, nCol;
-    sal_uInt16 nRow;
-    r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol );
+    sal_uInt16 nTmpRow(0);
+    sal_uInt8 nTmpTab(0), nTmpCol(0);
+    r.ReadUInt16(nTmpRow).ReadUChar(nTmpTab).ReadUChar(nTmpCol);
+    SCTAB nTab(static_cast<SCTAB>(nTmpTab));
+    SCCOL nCol(static_cast<SCCOL>(nTmpCol));
+    SCROW nRow(static_cast<SCROW>(nTmpRow));
+
     n -= (n > 4) ? 4 : n;
 
     boost::scoped_array<sal_Char> pText(new sal_Char[n + 1]);
@@ -425,7 +443,7 @@ void OP_Note123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
     OUString aNoteText(pText.get(), strlen(pText.get()), rContext.pLotusRoot->eCharsetQ);
     pText.reset();
 
-    ScAddress aPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab) );
+    ScAddress aPos(nCol, nRow, nTab);
     ScNoteUtil::CreateNoteFromString( *rContext.pDoc, aPos, aNoteText, false, false );
 }
 
commit cced2f6b866877c39afe86f4af18622cb4022bef
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Nov 29 16:44:12 2014 +0000

    give us a parenStack which can grow to fit any input
    
    Change-Id: Ic464184fe367da33bf8c4790b82656b140e3cbd0

diff --git a/vcl/generic/glyphs/scrptrun.cxx b/vcl/generic/glyphs/scrptrun.cxx
index 965fbf1..cd7ce41 100644
--- a/vcl/generic/glyphs/scrptrun.cxx
+++ b/vcl/generic/glyphs/scrptrun.cxx
@@ -175,7 +175,11 @@ UBool ScriptRun::next()
         // characters above it on the stack will be poped.
         if (pairIndex >= 0) {
             if ((pairIndex & 1) == 0) {
-                parenStack[++parenSP].pairIndex = pairIndex;
+                ++parenSP;
+                int32_t nVecSize = parenStack.size();
+                if (parenSP == nVecSize)
+                    parenStack.resize(nVecSize + 128);
+                parenStack[parenSP].pairIndex = pairIndex;
                 parenStack[parenSP].scriptCode  = scriptCode;
             } else if (parenSP >= 0) {
                 int32_t pi = pairIndex & ~1;
diff --git a/vcl/generic/glyphs/scrptrun.h b/vcl/generic/glyphs/scrptrun.h
index 56ea88c..3dea2e4 100644
--- a/vcl/generic/glyphs/scrptrun.h
+++ b/vcl/generic/glyphs/scrptrun.h
@@ -43,6 +43,7 @@
 #include "unicode/utypes.h"
 #include "unicode/uobject.h"
 #include "unicode/uscript.h"
+#include <vector>
 
 namespace vcl {
 
@@ -112,7 +113,7 @@ private:
     int32_t scriptEnd;
     UScriptCode scriptCode;
 
-    ParenStackEntry parenStack[128];
+    std::vector<ParenStackEntry> parenStack;
     int32_t parenSP;
 
     static int8_t highBit(int32_t value);
@@ -166,6 +167,7 @@ inline void ScriptRun::reset()
     scriptEnd   = charStart;
     scriptCode  = USCRIPT_INVALID_CODE;
     parenSP     = -1;
+    parenStack.resize(128);
 }
 
 inline void ScriptRun::reset(int32_t start, int32_t length)
commit 093ed85875331f57ba32b382f0efa211f36e5abe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 28 17:05:38 2014 +0000

    coverity#1213364 Untrusted loop bound
    
    Change-Id: I518c4819fd4efe605dab0e73c58f8a8c7691b26d

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 545222a..bd9a1fe 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -435,15 +435,18 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin
 
     /* determine the last point and be extra safe about it. But probably this code is not needed */
     sal_uInt16 lastPoint=0;
-    for (i=0; i<numberOfContours; i++) {
+    sal_uInt32 nOffset = 10 + numberOfContours + 2;
+    if (nOffset > nTableSize)
+        return 0;
+    for (i=0; i<numberOfContours; i++)
+    {
         const sal_uInt16 t = GetUInt16(ptr, 10+i*2, 1);
         if (t > lastPoint)
             lastPoint = t;
     }
 
     sal_uInt16 instLen = GetUInt16(ptr, 10 + numberOfContours*2, 1);
-
-    const sal_uInt32 nOffset = 10 + 2 * numberOfContours + 2 + instLen;
+    nOffset = 10 + 2 * numberOfContours + 2 + instLen;
     if (nOffset > nTableSize)
         return 0;
     const sal_uInt8* p = ptr + nOffset;


More information about the Libreoffice-commits mailing list