diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-18 09:32:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-10-18 12:50:48 +0200 |
commit | 9f2ffd3dfd6af9a3e558734138cc155f5dcb8be7 (patch) | |
tree | 1ede4e863cc97a00d78ad9be7ca7b7f009b9b68a /sdext | |
parent | 29e625fa661c7176c761255c168736416e75d600 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfentries.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
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; } |