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

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

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
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 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_page.h" 9 #include "../../../include/fpdfapi/fpdf_page.h"
10 #include "../../../src/fxcrt/fx_safe_types.h" 10 #include "../../../src/fxcrt/fx_safe_types.h"
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 m_Pos = StreamStartPos; 2470 m_Pos = StreamStartPos;
2471 if (FindTag(FX_BSTRC("endobj"), 0) < 0) { 2471 if (FindTag(FX_BSTRC("endobj"), 0) < 0) {
2472 return NULL; 2472 return NULL;
2473 } 2473 }
2474 } 2474 }
2475 } 2475 }
2476 m_Pos = StreamStartPos; 2476 m_Pos = StreamStartPos;
2477 } 2477 }
2478 CPDF_Stream* pStream; 2478 CPDF_Stream* pStream;
2479 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); 2479 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len);
2480 if (!pData) {
2481 return NULL;
2482 }
2480 ReadBlock(pData, len); 2483 ReadBlock(pData, len);
2481 if (pCryptoHandler) { 2484 if (pCryptoHandler) {
2482 CFX_BinaryBuf dest_buf; 2485 CFX_BinaryBuf dest_buf;
2483 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); 2486 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len));
2484 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum); 2487 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum);
2485 pCryptoHandler->DecryptStream(context, pData, len, dest_buf); 2488 pCryptoHandler->DecryptStream(context, pData, len, dest_buf);
2486 pCryptoHandler->DecryptFinish(context, dest_buf); 2489 pCryptoHandler->DecryptFinish(context, dest_buf);
2487 FX_Free(pData); 2490 FX_Free(pData);
2488 pData = dest_buf.GetBuffer(); 2491 pData = dest_buf.GetBuffer();
2489 len = dest_buf.GetSize(); 2492 len = dest_buf.GetSize();
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 { 4642 {
4640 FX_INT32 iSize = m_childNode.GetSize(); 4643 FX_INT32 iSize = m_childNode.GetSize();
4641 for (FX_INT32 i = 0; i < iSize; ++i) { 4644 for (FX_INT32 i = 0; i < iSize; ++i) {
4642 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4645 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4643 if (pNode) { 4646 if (pNode) {
4644 delete pNode; 4647 delete pNode;
4645 } 4648 }
4646 } 4649 }
4647 m_childNode.RemoveAll(); 4650 m_childNode.RemoveAll();
4648 } 4651 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698