From 9f2ffd3dfd6af9a3e558734138cc155f5dcb8be7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 18 Oct 2019 09:32:19 +0100 Subject: cid#1448423 silence Wrapper object use after free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5369a82507845bbe248c35c7faf517ac57f73f67 Reviewed-on: https://gerrit.libreoffice.org/81025 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sdext/source/pdfimport/pdfparse/pdfentries.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 pValu if( ! pValue ) eraseValue( rName ); - auto pValueTmp = pValue.get(); + PDFEntry* pValueTmp = nullptr; std::unordered_map::iterator it = m_aMap.find( rName ); if( it == m_aMap.end() ) { // new name/value, pair, append it m_aSubElements.emplace_back(std::make_unique(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 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; } -- cgit