diff options
author | Eike Rathke [er] <eike.rathke@oracle.com> | 2012-07-27 17:27:55 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-27 17:50:21 +0200 |
commit | 30329249f68e805b7071341cfd6a5d6bcb42f1c8 (patch) | |
tree | cd3ce6352fba59d8e2da5ffdaadae1e47a4304fc | |
parent | RTFDocumentImpl::text: don't try to read beyond the end of string (diff) | |
download | core-30329249f68e805b7071341cfd6a5d6bcb42f1c8.tar.gz core-30329249f68e805b7071341cfd6a5d6bcb42f1c8.zip |
QuattroPro warnings
-rw-r--r-- | sc/source/filter/qpro/qpro.cxx | 20 |
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++; } |