diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-05 12:25:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-05 12:52:08 +0100 |
commit | 779aa2077d3f25cf19f74acd69e1f6d819b4610c (patch) | |
tree | 3d5ad722d5de4ed36ff2e20bce136e0fd3af6170 /sw | |
parent | 452584805c0356f335563ce9dc8c021be5ded9b7 (diff) |
CID#1079393 Wrapper object use after free
If coverity is taking exceptions into account its right, if its not
then its a false positive. Lets do the save and restore on scope
to find out.
Change-Id: I007f86d701e193c2e097a186119c1d0b367cbb97
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7f08f583b62b..b7c528adace7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -289,6 +289,23 @@ void lcl_TextFrameShadow(FSHelperPtr pSerializer, const SwFrmFmt& rFrmFmt) FSEND); } +class ExportDataSaveRestore +{ +private: + DocxExport& m_rExport; +public: + ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, sw::Frame *pParentFrame) + : m_rExport(rExport) + { + m_rExport.SaveData(nStt, nEnd); + m_rExport.mpParentFrame = pParentFrame; + } + ~ExportDataSaveRestore() + { + m_rExport.RestoreData(); + } +}; + void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ) { // write the paragraph properties + the run, already in the correct order @@ -309,9 +326,8 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0; sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; - m_rExport.SaveData( nStt, nEnd ); - - m_rExport.mpParentFrame = pParentFrame; + //Save data here and restore when out of scope + ExportDataSaveRestore aDataGuard(m_rExport, nStt, nEnd, pParentFrame); // When a frame has some low height, but automatically expanded due // to lots of contents, this size contains the real size. @@ -358,9 +374,6 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT m_pSerializer->endElementNS( XML_v, XML_rect ); m_pSerializer->endElementNS( XML_w, XML_pict ); m_pSerializer->endElementNS( XML_w, XML_r ); - - m_rExport.RestoreData(); - } m_pSerializer->endElementNS( XML_w, XML_p ); |