Use UnownedPtr to check CFX_*StringC lifetimes
Change interform to avoid temp StringC with dangling ptr.
Change-Id: I8d8659973bcdf2cdbcaa6efa6012e4acce5f1604
Reviewed-on: https://pdfium-review.googlesource.com/5571
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 2d02a7a..76cb6fd 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -502,9 +502,8 @@
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
CFX_ByteTextBuf& textBuf) {
- std::unique_ptr<CFDF_Document> pFDF =
- m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath().AsStringC(),
- fields, bIncludeOrExclude, false);
+ std::unique_ptr<CFDF_Document> pFDF = m_pInterForm->ExportToFDF(
+ m_pFormFillEnv->JS_docGetFilePath(), fields, bIncludeOrExclude, false);
return pFDF ? pFDF->WriteBuf(textBuf) : false;
}
@@ -521,8 +520,8 @@
if (!m_pFormFillEnv || !m_pInterForm)
return false;
- std::unique_ptr<CFDF_Document> pFDFDoc = m_pInterForm->ExportToFDF(
- m_pFormFillEnv->JS_docGetFilePath().AsStringC(), false);
+ std::unique_ptr<CFDF_Document> pFDFDoc =
+ m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false);
if (!pFDFDoc)
return false;
@@ -543,8 +542,8 @@
}
bool CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) {
- std::unique_ptr<CFDF_Document> pFDF = m_pInterForm->ExportToFDF(
- m_pFormFillEnv->JS_docGetFilePath().AsStringC(), false);
+ std::unique_ptr<CFDF_Document> pFDF =
+ m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false);
return pFDF && pFDF->WriteBuf(textBuf);
}