diff options
Diffstat (limited to 'xfa/fde')
-rw-r--r-- | xfa/fde/tto/fde_textout.cpp | 5 | ||||
-rw-r--r-- | xfa/fde/xml/fde_xml_imp.cpp | 8 |
2 files changed, 4 insertions, 9 deletions
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index c9f5ec84ef..f816176841 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -775,10 +775,7 @@ int32_t CFDE_TTOLine::GetSize() const { } FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) { - if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_pieces)) - return nullptr; - - return &m_pieces[index]; + return pdfium::IndexInBounds(m_pieces, index) ? &m_pieces[index] : nullptr; } void CFDE_TTOLine::RemoveLast(int32_t icount) { diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index 0959661b26..334410049c 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -652,7 +652,7 @@ int32_t CFDE_XMLInstruction::CountData() const { } bool CFDE_XMLInstruction::GetData(int32_t index, CFX_WideString& wsData) const { - if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_TargetData)) + if (!pdfium::IndexInBounds(m_TargetData, index)) return false; wsData = m_TargetData[index]; @@ -664,10 +664,8 @@ void CFDE_XMLInstruction::AppendData(const CFX_WideString& wsData) { } void CFDE_XMLInstruction::RemoveData(int32_t index) { - if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_TargetData)) - return; - - m_TargetData.erase(m_TargetData.begin() + index); + if (pdfium::IndexInBounds(m_TargetData, index)) + m_TargetData.erase(m_TargetData.begin() + index); } CFDE_XMLInstruction::~CFDE_XMLInstruction() {} |