Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3206)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 1535753003: Merge to XFA: Correct return values in CPDF_HintTables::CheckPage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bdbb939148ced7c1f902924745106a58bc7169b4..e098112ba1bb9aefa832dc95d40a08b0594a3703 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -4907,11 +4907,11 @@ int32_t CPDF_HintTables::CheckPage(int index, IFX_DownloadHints* pHints) {
if (index == nFirstAvailPage)
return IPDF_DataAvail::DataAvailable;
FX_DWORD dwLength = GetItemLength(index, m_szPageOffsetArray);
- if (!dwLength ||
- !m_pDataAvail->IsDataAvail(m_szPageOffsetArray[index], dwLength,
- pHints)) {
+ // If two pages have the same offset, it should be treated as an error.
+ if (!dwLength)
+ return IPDF_DataAvail::DataError;
+ if (!m_pDataAvail->IsDataAvail(m_szPageOffsetArray[index], dwLength, pHints))
return IPDF_DataAvail::DataNotAvailable;
- }
// Download data of shared objects in the page.
FX_DWORD offset = 0;
for (int i = 0; i < index; ++i) {
@@ -4920,7 +4920,7 @@ int32_t CPDF_HintTables::CheckPage(int index, IFX_DownloadHints* pHints) {
CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O");
int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
if (nFirstPageObjNum < 0)
- return FALSE; // TODO(thestig): Fix this and the return type.
+ return IPDF_DataAvail::DataError;
FX_DWORD dwIndex = 0;
FX_DWORD dwObjNum = 0;
for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) {
@@ -4933,8 +4933,10 @@ int32_t CPDF_HintTables::CheckPage(int index, IFX_DownloadHints* pHints) {
continue;
}
dwLength = GetItemLength(dwIndex, m_szSharedObjOffsetArray);
- if (!dwLength ||
- !m_pDataAvail->IsDataAvail(m_szSharedObjOffsetArray[dwIndex], dwLength,
+ // If two objects have the same offset, it should be treated as an error.
+ if (!dwLength)
+ return IPDF_DataAvail::DataError;
+ if (!m_pDataAvail->IsDataAvail(m_szSharedObjOffsetArray[dwIndex], dwLength,
pHints)) {
return IPDF_DataAvail::DataNotAvailable;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698