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

Side by Side Diff: fpdfsdk/src/fpdfppo.cpp

Issue 553613003: Check the validity of pointers before they are utilized (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fpdfppo.h" 7 #include "../include/fpdfppo.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 9
10 class CPDF_PageOrganizer 10 class CPDF_PageOrganizer
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 size_t dwNewObjNum = 0; 307 size_t dwNewObjNum = 0;
308 308
309 pMapPtrToPtr->Lookup((FX_LPVOID)dwObjnum, (FX_LPVOID&)dwNewObjNum); 309 pMapPtrToPtr->Lookup((FX_LPVOID)dwObjnum, (FX_LPVOID&)dwNewObjNum);
310 if(dwNewObjNum) 310 if(dwNewObjNum)
311 { 311 {
312 return (int)dwNewObjNum; 312 return (int)dwNewObjNum;
313 } 313 }
314 else 314 else
315 { 315 {
316 » » CPDF_Object* pClone = pRef->GetDirect()->Clone(); 316 » » CPDF_Object* pDirect = pRef->GetDirect();
317 » » if(!pClone)» » » 317 » » if(!pDirect)
318 » » {
318 return 0; 319 return 0;
320 }
321
322 CPDF_Object* pClone = pDirect->Clone();
Tom Sepez 2014/09/08 17:58:34 nit: stray space before equals.
323 if(!pClone)
324 {
325 return 0;
326 }
319 327
320 if(pClone->GetType() == PDFOBJ_DICTIONARY) 328 if(pClone->GetType() == PDFOBJ_DICTIONARY)
321 { 329 {
322 CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; 330 CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone;
323 if(pDictClone->KeyExist("Type")) 331 if(pDictClone->KeyExist("Type"))
324 { 332 {
325 CFX_ByteString strType = pDictClone->GetString(" Type"); 333 CFX_ByteString strType = pDictClone->GetString(" Type");
326 if(!FXSYS_stricmp(strType, "Pages")) 334 if(!FXSYS_stricmp(strType, "Pages"))
327 { 335 {
328 pDictClone->Release(); 336 pDictClone->Release();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if(!pSrcDict) 463 if(!pSrcDict)
456 return FALSE; 464 return FALSE;
457 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc; 465 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc;
458 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 466 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
459 if(!pDstDict) 467 if(!pDstDict)
460 return FALSE; 468 return FALSE;
461 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE)); 469 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE));
462 return TRUE; 470 return TRUE;
463 } 471 }
464 472
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698