Index: fpdfsdk/src/fpdfview.cpp |
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp |
index 159440de5953a1786269f0a4c6244d46faece0af..38a51f9ce2ac73201aefc2b54b18b9c70cab2924 100644 |
--- a/fpdfsdk/src/fpdfview.cpp |
+++ b/fpdfsdk/src/fpdfview.cpp |
@@ -237,12 +237,20 @@ DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, |
return FSDK_SetSandBoxPolicy(policy, enable); |
} |
+ |
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, |
FPDF_BYTESTRING password) { |
- CPDF_Parser* pParser = FX_NEW CPDF_Parser; |
+ // NOTE: the creation of the file needs to be by the embedder on the |
+ // other side of this API. |
+ IFX_FileRead* pFileAccess = FX_CreateFileRead((const FX_CHAR*)file_path); |
+ if (!pFileAccess) { |
+ return nullptr; |
+ } |
+ |
+ CPDF_Parser* pParser = new CPDF_Parser; |
pParser->SetPassword(password); |
- FX_DWORD err_code = pParser->StartParse((const FX_CHAR*)file_path); |
+ FX_DWORD err_code = pParser->StartParse(pFileAccess); |
if (err_code) { |
delete pParser; |
ProcessParseError(err_code); |