Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp

Issue 341333004: Fix crash in _CMapLookupCallback (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: generation number checking Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 void CPDF_Object::Release() 8 void CPDF_Object::Release()
9 { 9 {
10 if (m_ObjNum) { 10 if (m_ObjNum) {
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 return; 1264 return;
1265 } 1265 }
1266 ((CPDF_Object*)value)->Destroy(); 1266 ((CPDF_Object*)value)->Destroy();
1267 m_IndirectObjs.RemoveKey((FX_LPVOID)(FX_UINTPTR)objnum); 1267 m_IndirectObjs.RemoveKey((FX_LPVOID)(FX_UINTPTR)objnum);
1268 } 1268 }
1269 void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO bj) 1269 void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO bj)
1270 { 1270 {
1271 if (objnum == 0 || pObj == NULL) { 1271 if (objnum == 0 || pObj == NULL) {
1272 return; 1272 return;
1273 } 1273 }
1274 FX_LPVOID value; 1274 FX_LPVOID value = NULL;
1275 if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) { 1275 if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) {
1276 ((CPDF_Object*)value)->Destroy(); 1276 if (value)
1277 {
1278 if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum())
1279 return;
1280 else
1281 ((CPDF_Object*)value)->Destroy();
1282 }
1277 } 1283 }
1278 pObj->m_ObjNum = objnum; 1284 pObj->m_ObjNum = objnum;
1279 m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); 1285 m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj);
1280 if (m_LastObjNum < objnum) { 1286 if (m_LastObjNum < objnum) {
1281 m_LastObjNum = objnum; 1287 m_LastObjNum = objnum;
1282 } 1288 }
1283 } 1289 }
1284 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const 1290 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const
1285 { 1291 {
1286 return m_LastObjNum; 1292 return m_LastObjNum;
1287 } 1293 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_objects.h ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698