From ca03f7a1c654709152a411f665ce38c3626582e8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 6 Oct 2016 14:53:13 -0400 Subject: Fixup MSan embeddertests The embeddertests were closing the document before the formfill environment. This caused a use-after-free as we try to use the document during formfill destruction. This Cl fixes the destruction order in the embedder tests. As well, a few guards are put in place to keep the system from crashing if the wrong destruction order is called. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/2398063002 . --- fpdfsdk/fpdfxfa/cpdfxfa_document.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fpdfsdk/fpdfxfa') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp index bd7f931c59..90a762ddf3 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp @@ -45,6 +45,9 @@ CPDFXFA_Document::~CPDFXFA_Document() { if (m_pSDKDoc) { m_pSDKDoc->ClearAllFocusedAnnots(); + // Once we're deleted the SDKDocument will point at a bad underlying + // doc so we need to reset it ... + m_pSDKDoc->ResetXFADocument(); m_pSDKDoc = nullptr; } -- cgit v1.2.3