summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp31
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp81
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp165
4 files changed, 81 insertions, 200 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index be55a56d0f..a63b0ed336 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -313,10 +313,6 @@ FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
return m_pParser->GetPermissions(bCheckRevision);
}
-FX_BOOL CPDF_Document::IsOwner() const {
- return !m_pParser || m_pParser->IsOwner();
-}
-
FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
auto it = m_IndirectObjs.find(objnum);
if (it != m_IndirectObjs.end()) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 595e4d6da6..61becaee6a 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -59,22 +59,24 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() {
return new CPDF_StandardCryptoHandler;
}
+
typedef struct _PDF_CRYPTOITEM {
int32_t m_Cipher;
int32_t m_KeyLen;
FX_BOOL m_bChecked;
CPDF_StandardCryptoHandler* m_pCryptoHandler;
} PDF_CRYPTOITEM;
+
CPDF_StandardSecurityHandler::CPDF_StandardSecurityHandler() {
m_Version = 0;
m_Revision = 0;
m_pParser = NULL;
m_pEncryptDict = NULL;
- m_bOwner = FALSE;
m_Permissions = 0;
m_Cipher = FXCIPHER_NONE;
m_KeyLen = 0;
}
+
CPDF_StandardSecurityHandler::~CPDF_StandardSecurityHandler() {}
FX_BOOL CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser,
CPDF_Dictionary* pEncryptDict) {
@@ -97,7 +99,6 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) {
return FALSE;
}
}
- m_bOwner = TRUE;
return TRUE;
}
return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey,
@@ -151,9 +152,9 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
}
return TRUE;
}
+
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_pEncryptDict = pEncryptDict;
- m_bOwner = FALSE;
m_Version = pEncryptDict->GetIntegerBy("V");
m_Revision = pEncryptDict->GetIntegerBy("R");
m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
@@ -170,12 +171,12 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
}
return TRUE;
}
+
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
FX_DWORD type,
int& cipher,
int& key_len) {
m_pEncryptDict = pEncryptDict;
- m_bOwner = FALSE;
m_Version = pEncryptDict->GetIntegerBy("V");
m_Revision = pEncryptDict->GetIntegerBy("R");
m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
@@ -193,8 +194,8 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
m_Cipher = cipher;
m_KeyLen = key_len;
return TRUE;
- return TRUE;
}
+
FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher,
const uint8_t*& buffer,
int& keylen) {
@@ -384,12 +385,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
}
return TRUE;
}
-int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
- FX_DWORD pass_size,
- FX_BOOL bOwner,
- uint8_t* key) {
- return CheckPassword(password, pass_size, bOwner, key, m_KeyLen);
-}
+
int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
FX_DWORD size,
FX_BOOL bOwner,
@@ -458,11 +454,6 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
}
CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
const uint8_t* owner_pass,
- FX_DWORD pass_size) {
- return GetUserPassword(owner_pass, pass_size, m_KeyLen);
-}
-CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
- const uint8_t* owner_pass,
FX_DWORD pass_size,
int32_t key_len) {
CFX_ByteString okey = m_pEncryptDict->GetStringBy("O");
@@ -526,9 +517,11 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(
FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() {
return m_pEncryptDict->GetBooleanBy("EncryptMetadata", TRUE);
}
-CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() {
+
+IPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() {
return new CPDF_StandardSecurityHandler;
}
+
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
@@ -940,9 +933,10 @@ void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum,
FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size) {
return m_Cipher == FXCIPHER_AES ? src_size - 16 : src_size;
}
+
FX_BOOL CPDF_StandardCryptoHandler::Init(
CPDF_Dictionary* pEncryptDict,
- CPDF_SecurityHandler* pSecurityHandler) {
+ IPDF_SecurityHandler* pSecurityHandler) {
const uint8_t* key;
if (!pSecurityHandler->GetCryptInfo(m_Cipher, key, m_KeyLen)) {
return FALSE;
@@ -958,6 +952,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(
}
return TRUE;
}
+
FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher,
const uint8_t* key,
int keylen) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index f5701fefff..b80568b63c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -94,84 +94,3 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
<< " 0 R>>\r\n%%EOF\r\n";
return TRUE;
}
-CFX_WideString CFDF_Document::GetWin32Path() const {
- CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDictBy("FDF") : NULL;
- CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue("F") : NULL;
- if (!pFileSpec)
- return CFX_WideString();
- if (pFileSpec->IsString())
- return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDictBy("FDF"));
- return FPDF_FileSpec_GetWin32Path(pFileSpec);
-}
-static CFX_WideString ChangeSlash(const FX_WCHAR* str) {
- CFX_WideString result;
- while (*str) {
- if (*str == '\\') {
- result += '/';
- } else if (*str == '/') {
- result += '\\';
- } else {
- result += *str;
- }
- str++;
- }
- return result;
-}
-void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec,
- const CFX_WideString& filepath) {
- CFX_WideString result;
- if (filepath.GetLength() > 1 && filepath[1] == ':') {
- result = L"/";
- result += filepath[0];
- if (filepath[2] != '\\') {
- result += '/';
- }
- result += ChangeSlash(filepath.c_str() + 2);
- } else if (filepath.GetLength() > 1 && filepath[0] == '\\' &&
- filepath[1] == '\\') {
- result = ChangeSlash(filepath.c_str() + 1);
- } else {
- result = ChangeSlash(filepath.c_str());
- }
-
- if (pFileSpec->IsString()) {
- pFileSpec->SetString(CFX_ByteString::FromUnicode(result));
- } else if (CPDF_Dictionary* pFileDict = pFileSpec->AsDictionary()) {
- pFileDict->SetAtString("F", CFX_ByteString::FromUnicode(result));
- pFileDict->SetAtString("UF", PDF_EncodeText(result));
- pFileDict->RemoveAt("FS");
- }
-}
-CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) {
- CFX_WideString wsFileName;
- if (!pFileSpec) {
- wsFileName = CFX_WideString();
- } else if (const CPDF_Dictionary* pDict = pFileSpec->AsDictionary()) {
- wsFileName = pDict->GetUnicodeTextBy("UF");
- if (wsFileName.IsEmpty()) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F"));
- }
- if (pDict->GetStringBy("FS") == "URL") {
- return wsFileName;
- }
- if (wsFileName.IsEmpty() && pDict->KeyExist("DOS")) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS"));
- }
- } else {
- wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString());
- }
- if (wsFileName[0] != '/') {
- return ChangeSlash(wsFileName.c_str());
- }
- if (wsFileName[2] == '/') {
- CFX_WideString result;
- result += wsFileName[1];
- result += ':';
- result += ChangeSlash(wsFileName.c_str() + 2);
- return result;
- }
- CFX_WideString result;
- result += '\\';
- result += ChangeSlash(wsFileName.c_str());
- return result;
-}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 010554335d..653ce2888e 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -97,19 +97,18 @@ bool IsSignatureDict(const CPDF_Dictionary* pDict) {
return pType && pType->GetString() == "Sig";
}
-CPDF_Parser::CPDF_Parser() {
- m_pDocument = NULL;
- m_pTrailer = NULL;
- m_pEncryptDict = NULL;
- m_pLinearized = NULL;
- m_dwFirstPageNo = 0;
- m_dwXrefStartObjNum = 0;
- m_bOwnFileRead = TRUE;
- m_FileVersion = 0;
- m_bForceUseSecurityHandler = FALSE;
-}
+CPDF_Parser::CPDF_Parser()
+ : m_pDocument(nullptr),
+ m_bOwnFileRead(true),
+ m_FileVersion(0),
+ m_pTrailer(nullptr),
+ m_pEncryptDict(nullptr),
+ m_pLinearized(nullptr),
+ m_dwFirstPageNo(0),
+ m_dwXrefStartObjNum(0) {}
+
CPDF_Parser::~CPDF_Parser() {
- CloseParser(FALSE);
+ CloseParser();
}
FX_DWORD CPDF_Parser::GetLastObjNum() const {
@@ -120,15 +119,28 @@ bool CPDF_Parser::IsValidObjectNumber(FX_DWORD objnum) const {
return !m_ObjectInfo.empty() && objnum <= m_ObjectInfo.rbegin()->first;
}
-void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) {
- m_pEncryptDict = pDict;
-}
-
FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(FX_DWORD objnum) const {
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.pos : 0;
}
+uint8_t CPDF_Parser::GetObjectType(FX_DWORD objnum) const {
+ return m_V5Type[objnum];
+}
+
+uint16_t CPDF_Parser::GetObjectGenNum(FX_DWORD objnum) const {
+ return m_ObjVersion[objnum];
+}
+
+bool CPDF_Parser::IsObjectFreeOrNull(FX_DWORD objnum) const {
+ uint8_t type = GetObjectType(objnum);
+ return type == 0 || type == 255;
+}
+
+void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) {
+ m_pEncryptDict = pDict;
+}
+
void CPDF_Parser::ShrinkObjectMap(FX_DWORD objnum) {
if (objnum == 0) {
m_ObjectInfo.clear();
@@ -145,21 +157,20 @@ void CPDF_Parser::ShrinkObjectMap(FX_DWORD objnum) {
m_ObjectInfo[objnum - 1].pos = 0;
}
-void CPDF_Parser::CloseParser(FX_BOOL bReParse) {
+void CPDF_Parser::CloseParser() {
m_bVersionUpdated = FALSE;
- if (!bReParse) {
- delete m_pDocument;
- m_pDocument = NULL;
- }
+ delete m_pDocument;
+ m_pDocument = nullptr;
+
if (m_pTrailer) {
m_pTrailer->Release();
- m_pTrailer = NULL;
+ m_pTrailer = nullptr;
}
ReleaseEncryptHandler();
- SetEncryptDictionary(NULL);
+ SetEncryptDictionary(nullptr);
if (m_bOwnFileRead && m_Syntax.m_pFileAccess) {
m_Syntax.m_pFileAccess->Release();
- m_Syntax.m_pFileAccess = NULL;
+ m_Syntax.m_pFileAccess = nullptr;
}
m_ObjectStreamMap.clear();
m_ObjCache.clear();
@@ -176,21 +187,19 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse) {
m_Trailers.RemoveAll();
if (m_pLinearized) {
m_pLinearized->Release();
- m_pLinearized = NULL;
+ m_pLinearized = nullptr;
}
}
-CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
- FX_BOOL bReParse,
- FX_BOOL bOwnFileRead) {
- CloseParser(bReParse);
+CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess) {
+ CloseParser();
m_bXRefStream = FALSE;
m_LastXRefOffset = 0;
- m_bOwnFileRead = bOwnFileRead;
+ m_bOwnFileRead = true;
int32_t offset = GetHeaderOffset(pFileAccess);
if (offset == -1) {
- if (bOwnFileRead && pFileAccess)
+ if (pFileAccess)
pFileAccess->Release();
return FORMAT_ERROR;
}
@@ -211,8 +220,7 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
return FORMAT_ERROR;
m_Syntax.RestorePos(m_Syntax.m_FileLen - m_Syntax.m_HeaderOffset - 9);
- if (!bReParse)
- m_pDocument = new CPDF_Document(this);
+ m_pDocument = new CPDF_Document(this);
FX_BOOL bXRefRebuilt = FALSE;
if (m_Syntax.SearchWord("startxref", TRUE, FALSE, 4096)) {
@@ -300,25 +308,12 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
SetEncryptDictionary(pEncryptObj->GetDict());
}
}
- if (m_bForceUseSecurityHandler) {
- if (!m_pSecurityHandler) {
- return HANDLER_ERROR;
- }
- if (!m_pSecurityHandler->OnInit(this, m_pEncryptDict)) {
- return HANDLER_ERROR;
- }
- std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler(
- m_pSecurityHandler->CreateCryptoHandler());
- if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) {
- return HANDLER_ERROR;
- }
- m_Syntax.SetEncrypt(pCryptoHandler.release());
- } else if (m_pEncryptDict) {
+ if (m_pEncryptDict) {
CFX_ByteString filter = m_pEncryptDict->GetStringBy("Filter");
- std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler;
+ std::unique_ptr<IPDF_SecurityHandler> pSecurityHandler;
Error err = HANDLER_ERROR;
if (filter == "Standard") {
- pSecurityHandler.reset(FPDF_CreateStandardSecurityHandler());
+ pSecurityHandler.reset(new CPDF_StandardSecurityHandler);
err = PASSWORD_ERROR;
}
if (!pSecurityHandler) {
@@ -330,18 +325,16 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
m_pSecurityHandler = std::move(pSecurityHandler);
std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler(
m_pSecurityHandler->CreateCryptoHandler());
- if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) {
+ if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get()))
return HANDLER_ERROR;
- }
- m_Syntax.SetEncrypt(pCryptoHandler.release());
+ m_Syntax.SetEncrypt(std::move(pCryptoHandler));
}
return SUCCESS;
}
+
void CPDF_Parser::ReleaseEncryptHandler() {
m_Syntax.m_pCryptoHandler.reset();
- if (!m_bForceUseSecurityHandler) {
- m_pSecurityHandler.reset();
- }
+ m_pSecurityHandler.reset();
}
FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) const {
@@ -1496,19 +1489,7 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
}
return dwPermission;
}
-FX_BOOL CPDF_Parser::IsOwner() {
- return !m_pSecurityHandler || m_pSecurityHandler->IsOwner();
-}
-void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler,
- FX_BOOL bForced) {
- m_bForceUseSecurityHandler = bForced;
- m_pSecurityHandler.reset(pSecurityHandler);
- if (m_bForceUseSecurityHandler) {
- return;
- }
- m_Syntax.m_pCryptoHandler.reset(pSecurityHandler->CreateCryptoHandler());
- m_Syntax.m_pCryptoHandler->Init(NULL, pSecurityHandler);
-}
+
FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
FX_DWORD offset) {
m_Syntax.InitParser(pFileAccess, offset);
@@ -1560,24 +1541,20 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
m_pLinearized = NULL;
return FALSE;
}
-CPDF_Parser::Error CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
- FX_BOOL bReParse,
- FX_BOOL bOwnFileRead) {
- CloseParser(bReParse);
+CPDF_Parser::Error CPDF_Parser::StartAsyncParse(IFX_FileRead* pFileAccess) {
+ CloseParser();
m_bXRefStream = FALSE;
m_LastXRefOffset = 0;
- m_bOwnFileRead = bOwnFileRead;
+ m_bOwnFileRead = true;
int32_t offset = GetHeaderOffset(pFileAccess);
if (offset == -1) {
return FORMAT_ERROR;
}
if (!IsLinearizedFile(pFileAccess, offset)) {
- m_Syntax.m_pFileAccess = NULL;
- return StartParse(pFileAccess, bReParse, bOwnFileRead);
- }
- if (!bReParse) {
- m_pDocument = new CPDF_Document(this);
+ m_Syntax.m_pFileAccess = nullptr;
+ return StartParse(pFileAccess);
}
+ m_pDocument = new CPDF_Document(this);
FX_FILESIZE dwFirstXRefOffset = m_Syntax.SavePos();
FX_BOOL bXRefRebuilt = FALSE;
FX_BOOL bLoadV4 = FALSE;
@@ -1642,6 +1619,7 @@ CPDF_Parser::Error CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
}
return SUCCESS;
}
+
FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) {
if (!LoadCrossRefV5(&xrefpos, FALSE)) {
return FALSE;
@@ -2590,18 +2568,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(const CFX_ByteStringC& tag,
}
return -1;
}
-void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size) {
- FX_DWORD offset = 0;
- uint8_t ch;
- while (1) {
- if (!GetNextChar(ch)) {
- return;
- }
- buffer[offset++] = ch;
- if (offset == size) {
- break;
- }
- }
+
+void CPDF_SyntaxParser::SetEncrypt(
+ std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) {
+ m_pCryptoHandler = std::move(pCryptoHandler);
}
class CPDF_DataAvail final : public IPDF_DataAvail {
@@ -2868,7 +2838,7 @@ CPDF_DataAvail::CPDF_DataAvail(IFX_FileAvail* pFileAvail,
m_pPageDict = NULL;
m_pPageResource = NULL;
m_docStatus = PDF_DATAAVAIL_HEADER;
- m_parser.m_bOwnFileRead = FALSE;
+ m_parser.m_bOwnFileRead = false;
m_bTotalLoadPageTree = FALSE;
m_bCurPageDictLoadOK = FALSE;
m_bLinearedDataOK = FALSE;
@@ -2894,15 +2864,16 @@ void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
m_pDocument = pDoc;
}
FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
- CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser());
+ CPDF_Parser* pParser = m_pDocument->GetParser();
if (!pParser || !pParser->IsValidObjectNumber(objnum))
return 0;
- if (pParser->m_V5Type[objnum] == 2)
- objnum = pParser->m_ObjectInfo[objnum].pos;
+ if (pParser->GetObjectType(objnum) == 2)
+ objnum = pParser->GetObjectPositionOrZero(objnum);
- if (pParser->m_V5Type[objnum] == 1 || pParser->m_V5Type[objnum] == 255) {
- offset = pParser->m_ObjectInfo[objnum].pos;
+ if (pParser->GetObjectType(objnum) == 1 ||
+ pParser->GetObjectType(objnum) == 255) {
+ offset = pParser->GetObjectPositionOrZero(objnum);
if (offset == 0) {
return 0;
}
@@ -3136,7 +3107,7 @@ FX_BOOL CPDF_DataAvail::LoadAllFile(IFX_DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::LoadAllXref(IFX_DownloadHints* pHints) {
m_parser.m_Syntax.InitParser(m_pFileRead, (FX_DWORD)m_dwHeaderOffset);
- m_parser.m_bOwnFileRead = FALSE;
+ m_parser.m_bOwnFileRead = false;
if (!m_parser.LoadAllCrossRefV4(m_dwLastXRefOffset) &&
!m_parser.LoadAllCrossRefV5(m_dwLastXRefOffset)) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;