summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-03-22 18:28:45 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-22 22:58:09 +0000
commitd9d20a47e2c9af8630536786d614eaed229056a8 (patch)
tree7c8b998d3cc564261e294f56cde48696fca513d3 /core
parentffc6d599a15a3e0264abb905ab05f59590864986 (diff)
downloadpdfium-d9d20a47e2c9af8630536786d614eaed229056a8.tar.xz
Return errors after validation instead of ASSERT in CPDF_DataAvail
Change-Id: I909deca1d0bfc6de5ac0fd2e6956f9b918caf17a Reviewed-on: https://pdfium-review.googlesource.com/3157 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 127944037b..5a2db8861c 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -1413,9 +1413,8 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedFirstPage(
return DataNotAvailable;
m_bAnnotsLoad = true;
}
- const bool is_page_valid = ValidatePage(dwPage);
- (void)is_page_valid;
- ASSERT(is_page_valid);
+ if (!ValidatePage(dwPage))
+ return DataError;
return DataAvailable;
}
@@ -1559,9 +1558,8 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
ResetFirstCheck(dwPage);
m_pagesLoadState.insert(dwPage);
- const bool is_page_valid = ValidatePage(dwPage);
- (void)is_page_valid;
- ASSERT(is_page_valid);
+ if (!ValidatePage(dwPage))
+ return DataError;
return DataAvailable;
}
@@ -1625,7 +1623,8 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) {
m_pDocument->ReplaceIndirectObjectIfHigherGeneration(
dwObjNum, ParseIndirectObjectAt(0, dwObjNum, m_pDocument));
}
- ValidatePage(index);
+ if (!ValidatePage(index))
+ return nullptr;
return m_pDocument->GetPage(index);
}
@@ -1661,9 +1660,8 @@ CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
}
m_objs_array.clear();
- const bool is_form_valid = ValidateForm();
- (void)is_form_valid;
- ASSERT(is_form_valid);
+ if (!ValidateForm())
+ return FormError;
return FormAvailable;
}