| Index: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
|
| diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
|
| index eb3f156b2db074b86b1590f944666d4a7e729ac3..c20a483764ae1651242186f00e012e6e52e2e886 100644
|
| --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
|
| +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
|
| @@ -1233,12 +1233,13 @@
|
| return 0;
|
|
|
| m_ObjectOffset[objnum] = m_Offset;
|
| - FX_BOOL bExistInMap = !!m_pDocument->GetIndirectObject(objnum);
|
| + FX_BOOL bExistInMap =
|
| + pdfium::ContainsKey(m_pDocument->m_IndirectObjs, objnum);
|
| const uint8_t object_type = m_pParser->GetObjectType(objnum);
|
| bool bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream;
|
| if (m_pParser->IsVersionUpdated() || m_bSecurityChanged || bExistInMap ||
|
| bObjStm) {
|
| - CPDF_Object* pObj = m_pDocument->GetOrParseIndirectObject(objnum);
|
| + CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
|
| if (!pObj) {
|
| m_ObjectOffset[objnum] = 0;
|
| return 0;
|
| @@ -1319,13 +1320,13 @@
|
| int32_t index = (int32_t)(uintptr_t)m_Pos;
|
| while (index < iCount) {
|
| uint32_t objnum = m_NewObjNumArray.ElementAt(index);
|
| - CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
|
| - if (!pObj) {
|
| + auto it = m_pDocument->m_IndirectObjs.find(objnum);
|
| + if (it == m_pDocument->m_IndirectObjs.end()) {
|
| ++index;
|
| continue;
|
| }
|
| m_ObjectOffset[objnum] = m_Offset;
|
| - if (WriteIndirectObj(pObj)) {
|
| + if (WriteIndirectObj(it->second)) {
|
| return -1;
|
| }
|
| index++;
|
| @@ -1362,7 +1363,7 @@
|
| void CPDF_Creator::InitNewObjNumOffsets() {
|
| FX_BOOL bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
|
| FX_BOOL bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
|
| - for (const auto& pair : *m_pDocument) {
|
| + for (const auto& pair : m_pDocument->m_IndirectObjs) {
|
| const uint32_t objnum = pair.first;
|
| const CPDF_Object* pObj = pair.second;
|
| if (bIncremental || pObj->GetObjNum() == CPDF_Object::kInvalidObjNum)
|
| @@ -1702,7 +1703,7 @@
|
| return -1;
|
| }
|
| } else {
|
| - if (m_File.AppendDWord(m_pDocument->GetLastObjNum() + 1) < 0) {
|
| + if (m_File.AppendDWord(m_pDocument->m_LastObjNum + 1) < 0) {
|
| return -1;
|
| }
|
| if (m_File.AppendString(" 0 obj <<") < 0) {
|
|
|