Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
index 2105635687edd0f3e6fe3f44ee6dff568e5b2508..a71adc8b48649d943a2a68dd0270f6eff3c4351a 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
@@ -247,12 +247,9 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, |
} |
FXSYS_qsort(m_SortedOffset.GetData(), m_SortedOffset.GetSize(), |
sizeof(FX_FILESIZE), CompareFileSize); |
- FX_DWORD RootObjNum = GetRootObjNum(); |
- if (RootObjNum == 0) { |
+ if (GetRootObjNum() == 0) { |
ReleaseEncryptHandler(); |
- RebuildCrossRef(); |
- RootObjNum = GetRootObjNum(); |
- if (RootObjNum == 0) |
+ if (!RebuildCrossRef()) |
jun_fang
2015/12/01 15:25:18
please check the comment at line 1610.
Wei Li
2015/12/01 18:45:03
Acknowledged.
|
return PDFPARSE_ERROR_FORMAT; |
dwRet = SetEncryptHandler(); |
@@ -975,7 +972,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { |
m_SortedOffset.Add(offset); |
} |
FX_Free(buffer); |
- return TRUE; |
+ return m_pTrailer && GetRootObjNum() > 0 && m_CrossRef.GetSize() > 0; |
jun_fang
2015/12/01 15:20:58
The newly added condition ' GetRootObjNum() > 0' w
Wei Li
2015/12/01 18:45:03
I reverted to my original change. I think more tho
|
} |
FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, |
@@ -1608,14 +1605,11 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, |
} |
FXSYS_qsort(m_SortedOffset.GetData(), m_SortedOffset.GetSize(), |
sizeof(FX_FILESIZE), CompareFileSize); |
- FX_DWORD RootObjNum = GetRootObjNum(); |
- if (RootObjNum == 0) { |
jun_fang
2015/12/01 14:56:20
It's a trigger to rebuild cross reference table wh
Wei Li
2015/12/01 18:45:03
I saw this. But RebuildCrossRef function is used a
|
+ if (GetRootObjNum() == 0) { |
ReleaseEncryptHandler(); |
- RebuildCrossRef(); |
- RootObjNum = GetRootObjNum(); |
- if (RootObjNum == 0) { |
+ if (!RebuildCrossRef()) |
jun_fang
2015/12/01 15:20:58
Based on the analysis, I prefer to keep left code
Wei Li
2015/12/01 18:45:03
I would prefer keeping the check here as the comme
|
return PDFPARSE_ERROR_FORMAT; |
- } |
+ |
dwRet = SetEncryptHandler(); |
if (dwRet != PDFPARSE_ERROR_SUCCESS) { |
return dwRet; |