OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |