Kaydet (Commit) 33a8afed authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 (PVS)

V668 There is no sense in testing the 'pBuf' pointer against null, as the
     memory was allocated using the 'new' operator. The exception will be
     generated in the case of memory allocation error.

V547 Expression 'ePageKind == PPT_NOTEPAGE' is always true.

V581 The conditional expressions of the 'if' statements situated alongside
     each other are identical. Check lines: 3724, 3727.

V1023 A pointer without owner is added to the 'aCharPropList' container
      by the 'emplace_back' method. A memory leak will occur in case of
      an exception.

Change-Id: I5edae28a6ca1023a512fd5f86208951d439db941
Reviewed-on: https://gerrit.libreoffice.org/62131
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 96762d29
......@@ -2079,15 +2079,12 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
sal_uInt32 nToCopy, nBufSize;
nToCopy = pHd->nRecLen;
std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ 0x40000 ]); // 256KB Buffer
if ( pBuf )
while ( nToCopy )
{
while ( nToCopy )
{
nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy;
rStCtrl.ReadBytes(pBuf.get(), nBufSize);
xOriginal->WriteBytes(pBuf.get(), nBufSize);
nToCopy -= nBufSize;
}
nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy;
rStCtrl.ReadBytes(pBuf.get(), nBufSize);
xOriginal->WriteBytes(pBuf.get(), nBufSize);
nToCopy -= nBufSize;
}
}
}
......@@ -2203,12 +2200,15 @@ bool SdrPowerPointImport::ReadFontCollection()
PptSlidePersistList* SdrPowerPointImport::GetPageList(PptPageKind ePageKind) const
{
if ( ePageKind == PPT_MASTERPAGE )
return m_pMasterPages.get();
if ( ePageKind == PPT_SLIDEPAGE )
return m_pSlidePages.get();
if ( ePageKind == PPT_NOTEPAGE )
return m_pNotePages.get();
switch (ePageKind)
{
case PPT_MASTERPAGE:
return m_pMasterPages.get();
case PPT_SLIDEPAGE:
return m_pSlidePages.get();
case PPT_NOTEPAGE:
return m_pNotePages.get();
}
return nullptr;
}
......@@ -3722,11 +3722,9 @@ bool PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport const & rManag
if ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP )
pParaObj->UpdateBulletRelSize( nBulletHeight );
if ( nHardCount )
ImplGetNumberFormat( rManager, rNumberFormat );
if ( nHardCount )
{
ImplGetNumberFormat( rManager, rNumberFormat );
switch ( rNumberFormat.GetNumberingType() )
{
case SVX_NUM_CHARS_UPPER_LETTER :
......@@ -5295,7 +5293,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe
bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
nBuBlip, nHasAnm, nAnmScheme );
aCharPropList.emplace_back( new PPTCharPropSet( aCharPropSet, 0 ) );
aCharPropList.push_back(o3tl::make_unique<PPTCharPropSet>(aCharPropSet, 0));
}
}
......@@ -5356,7 +5354,8 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe
else if ( bEmptyParaPossible )
aCharPropSet.maString.clear();
if ( nLen || bEmptyParaPossible )
aCharPropList.emplace_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
aCharPropList.push_back(
o3tl::make_unique<PPTCharPropSet>(aCharPropSet, nCurrentPara));
nCurrentPara++;
nLen++;
nCharReadCnt += nLen;
......@@ -5369,7 +5368,8 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe
{
nLen = ( nCurrentSpecMarker & 0xffff ) - nCharReadCnt;
aCharPropSet.maString = aString.copy(nCharReadCnt, nLen);
aCharPropList.emplace_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
aCharPropList.push_back(
o3tl::make_unique<PPTCharPropSet>(aCharPropSet, nCurrentPara));
nCharCount -= nLen;
nCharReadCnt += nLen;
}
......@@ -5396,7 +5396,8 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe
nStrLen = nMaxStrLen;
aCharPropSet.maString = aString.copy(nCharReadCnt, nStrLen);
}
aCharPropList.emplace_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
aCharPropList.push_back(
o3tl::make_unique<PPTCharPropSet>(aCharPropSet, nCurrentPara));
nCharReadCnt += nCharCount;
bEmptyParaPossible = false;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment