summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/ttgsubtable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/font/ttgsubtable.cpp')
-rw-r--r--core/fpdfapi/font/ttgsubtable.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/fpdfapi/font/ttgsubtable.cpp b/core/fpdfapi/font/ttgsubtable.cpp
index 946ccd7abe..4fae5d41d2 100644
--- a/core/fpdfapi/font/ttgsubtable.cpp
+++ b/core/fpdfapi/font/ttgsubtable.cpp
@@ -127,9 +127,8 @@ bool CFX_CTTGSUBTable::GetVerticalGlyphSub(uint32_t glyphnum,
uint32_t* vglyphnum,
TFeature* Feature) {
for (int index : Feature->LookupListIndices) {
- if (index < 0 || index >= pdfium::CollectionSize<int>(LookupList.Lookups))
+ if (!pdfium::IndexInBounds(LookupList.Lookups, index))
continue;
-
if (LookupList.Lookups[index].LookupType == 1 &&
GetVerticalGlyphSub2(glyphnum, vglyphnum, &LookupList.Lookups[index])) {
return true;
@@ -154,8 +153,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyphSub2(uint32_t glyphnum,
case 2: {
auto* tbl2 = static_cast<TSingleSubstFormat2*>(subTable.get());
int index = GetCoverageIndex(tbl2->Coverage.get(), glyphnum);
- if (index >= 0 &&
- index < pdfium::CollectionSize<int>(tbl2->Substitutes)) {
+ if (pdfium::IndexInBounds(tbl2->Substitutes, index)) {
*vglyphnum = tbl2->Substitutes[index];
return true;
}