[Libreoffice-commits] core.git: sdext/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 18 10:51:59 UTC 2019
sdext/source/pdfimport/pdfparse/pdfentries.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 9f2ffd3dfd6af9a3e558734138cc155f5dcb8be7
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 18 09:32:19 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 18 12:50:48 2019 +0200
cid#1448423 silence Wrapper object use after free
Change-Id: I5369a82507845bbe248c35c7faf517ac57f73f67
Reviewed-on: https://gerrit.libreoffice.org/81025
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index b9c3c822c45a..ef2d4dc671a5 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -527,13 +527,14 @@ void PDFDict::insertValue( const OString& rName, std::unique_ptr<PDFEntry> pValu
if( ! pValue )
eraseValue( rName );
- auto pValueTmp = pValue.get();
+ PDFEntry* pValueTmp = nullptr;
std::unordered_map<OString,PDFEntry*>::iterator it = m_aMap.find( rName );
if( it == m_aMap.end() )
{
// new name/value, pair, append it
m_aSubElements.emplace_back(std::make_unique<PDFName>(rName));
m_aSubElements.emplace_back( std::move(pValue) );
+ pValueTmp = m_aSubElements.back().get();
}
else
{
@@ -543,10 +544,12 @@ void PDFDict::insertValue( const OString& rName, std::unique_ptr<PDFEntry> pValu
if( m_aSubElements[i].get() == it->second )
{
m_aSubElements[i] = std::move(pValue);
+ pValueTmp = m_aSubElements[i].get();
bFound = true;
break;
}
}
+ assert(pValueTmp);
m_aMap[ rName ] = pValueTmp;
}
More information about the Libreoffice-commits
mailing list