Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp |
index 990bf5f0e2cfeaf99dee194726a8c246cc3c44ca..edf80d0618c282849eac08c09f8be78621d97129 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp |
@@ -496,13 +496,18 @@ CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const { |
CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const { |
return ToArray(GetElementValue(i)); |
} |
-void CPDF_Array::RemoveAt(FX_DWORD i) { |
- ASSERT(IsArray()); |
+void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) { |
if (i >= (FX_DWORD)m_Objects.GetSize()) |
return; |
- if (CPDF_Object* p = static_cast<CPDF_Object*>(m_Objects.GetAt(i))) |
- p->Release(); |
- m_Objects.RemoveAt(i); |
+ |
+ if (nCount <= 0 || nCount > m_Objects.GetSize() - i) |
+ return; |
+ |
+ for (int j = 0; j < nCount; ++j) { |
+ if (CPDF_Object* p = static_cast<CPDF_Object*>(m_Objects.GetAt(i + j))) |
+ p->Release(); |
+ } |
+ m_Objects.RemoveAt(i, nCount); |
} |
void CPDF_Array::SetAt(FX_DWORD i, |
CPDF_Object* pObj, |