summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 7315754919..91cfe8c6c9 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -242,8 +242,12 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
return rects;
const int nCharListSize = CountChars();
+ if (start >= nCharListSize)
+ return rects;
+
if (nCount < 0 || start + nCount > nCharListSize)
nCount = nCharListSize - start;
+ ASSERT(nCount > 0);
CPDF_TextObject* pCurObj = nullptr;
CFX_FloatRect rect;