summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-11-10 19:04:33 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-10 19:04:33 +0000
commitff2a52cab523bc9de526f97bc060300e55f4506b (patch)
tree7989387e696d0508f434b76c2e7b325484969938
parent414af463d5504e456dc6a7f8ec7950fe1c55e393 (diff)
downloadpdfium-chromium/3239.tar.xz
[Merge M63] Make sure that iterator stays in bounds during IsHypenchromium/3239
TBR=dsinclair@chromium.org BUG=chromium:782596,chromium:781804 Change-Id: I020be3cf813221bb8314f045d83014a25cb9a950 Reviewed-on: https://pdfium-review.googlesource.com/18070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-on: https://pdfium-review.googlesource.com/18350 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fpdftext/cpdf_textpage.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 0a7a39fff5..d528c6994f 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -1226,20 +1226,17 @@ bool CPDF_TextPage::IsHyphen(wchar_t curChar) const {
return false;
auto iter = curText.rbegin();
- for (; iter != curText.rend() && *iter == 0x20; iter++) {
+ for (; (iter + 1) != curText.rend() && *iter == 0x20; iter++) {
// Do nothing
}
- if (iter != curText.rend()) {
- if (!IsHyphenCode(*iter))
- return false;
+ if (!IsHyphenCode(*iter))
+ return false;
+
+ if ((iter + 1) != curText.rend()) {
iter++;
if (FXSYS_iswalpha(*iter) && FXSYS_iswalpha(*iter))
return true;
- } else {
- iter--;
- if (!IsHyphenCode(*iter))
- return false;
}
const PAGECHAR_INFO* preInfo;