summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke [er] <eike.rathke@oracle.com>2012-07-27 17:27:55 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-27 17:50:21 +0200
commit30329249f68e805b7071341cfd6a5d6bcb42f1c8 (patch)
treecd3ce6352fba59d8e2da5ffdaadae1e47a4304fc /sc
parent55d72ab8ec4e4445e62f8224b5f54e97c464c4a5 (diff)
QuattroPro warnings
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/qpro/qpro.cxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index b8ee3ab9d800..8572e668d3a6 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -64,10 +64,16 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
case 0x000f:{ // Label cell
String aLabel;
*mpStream >> nCol >> nDummy >> nRow >> nStyle >> nDummy;
- readString( aLabel, getLength() - 7 );
- nStyle = nStyle >> 3;
- pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
- pDoc->PutCell( nCol, nRow, nTab, ScBaseCell::CreateTextCell( aLabel, pDoc ), true );
+ sal_uInt16 nLen = getLength();
+ if (nLen >= 7)
+ {
+ readString( aLabel, nLen - 7 );
+ nStyle = nStyle >> 3;
+ pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
+ pDoc->PutCell( nCol, nRow, nTab, ScBaseCell::CreateTextCell( aLabel, pDoc ), true );
+ }
+ else
+ eRet = eERR_FORMAT;
}
break;
@@ -195,7 +201,11 @@ FltError ScQProReader::import( ScDocument *pDoc )
String aLabel;
*mpStream >> nPtSize >> nFontAttr;
pStyleElement->setFontRecord( j, nFontAttr, nPtSize );
- readString( aLabel, getLength() - 4 );
+ sal_uInt16 nLen = getLength();
+ if (nLen >= 4)
+ readString( aLabel, nLen - 4 );
+ else
+ eRet = eERR_FORMAT;
pStyleElement->setFontType( j, aLabel );
j++;
}