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

Side by Side Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. Created 5 years, 7 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 | « core/include/fxge/fx_ge.h ('k') | core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp » ('j') | 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/fpdfapi/fpdf_serial.h" 7 #include "../../../include/fpdfapi/fpdf_serial.h"
8 #include "editint.h" 8 #include "editint.h"
9 #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024) 9 #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024)
10 #define PDF_XREFSTREAM_MAXSIZE 10000 10 #define PDF_XREFSTREAM_MAXSIZE 10000
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 return TRUE; 408 return TRUE;
409 } 409 }
410 if (pHandler == NULL) { 410 if (pHandler == NULL) {
411 m_pData = (FX_LPBYTE)src_data; 411 m_pData = (FX_LPBYTE)src_data;
412 m_dwSize = src_size; 412 m_dwSize = src_size;
413 m_bNewBuf = FALSE; 413 m_bNewBuf = FALSE;
414 return TRUE; 414 return TRUE;
415 } 415 }
416 m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size); 416 m_dwSize = pHandler->EncryptGetSize(objnum, 0, src_data, src_size);
417 m_pData = FX_Alloc(FX_BYTE, m_dwSize); 417 m_pData = FX_Alloc(FX_BYTE, m_dwSize);
418 if(!m_pData) {
419 return FALSE;
420 }
421 pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize); 418 pHandler->EncryptContent(objnum, 0, src_data, src_size, m_pData, m_dwSize);
422 m_bNewBuf = TRUE; 419 m_bNewBuf = TRUE;
423 return TRUE; 420 return TRUE;
424 } 421 }
425 CPDF_Encryptor::~CPDF_Encryptor() 422 CPDF_Encryptor::~CPDF_Encryptor()
426 { 423 {
427 if (m_bNewBuf) { 424 if (m_bNewBuf) {
428 FX_Free(m_pData); 425 FX_Free(m_pData);
429 } 426 }
430 } 427 }
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 m_bNewCrypto = FALSE; 2127 m_bNewCrypto = FALSE;
2131 if (!m_bStandardSecurity) { 2128 if (!m_bStandardSecurity) {
2132 return; 2129 return;
2133 } 2130 }
2134 if (m_pEncryptDict) { 2131 if (m_pEncryptDict) {
2135 m_pEncryptDict->Release(); 2132 m_pEncryptDict->Release();
2136 m_pEncryptDict = NULL; 2133 m_pEncryptDict = NULL;
2137 } 2134 }
2138 m_bStandardSecurity = FALSE; 2135 m_bStandardSecurity = FALSE;
2139 } 2136 }
OLDNEW
« no previous file with comments | « core/include/fxge/fx_ge.h ('k') | core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698