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

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

Issue 367383002: Fix for UMR in CXML_Parser::GetCharRef. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: AUTHORS 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
« no previous file with comments | « AUTHORS ('k') | 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/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 "../fpdf_page/pageint.h" 10 #include "../fpdf_page/pageint.h"
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 return NULL; 2404 return NULL;
2405 } 2405 }
2406 CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT * pContext, 2406 CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT * pContext,
2407 FX_DWORD objnum, FX_DWORD gennum) 2407 FX_DWORD objnum, FX_DWORD gennum)
2408 { 2408 {
2409 CPDF_Object* pLenObj = pDict->GetElement(FX_BSTRC("Length")); 2409 CPDF_Object* pLenObj = pDict->GetElement(FX_BSTRC("Length"));
2410 FX_DWORD len = 0; 2410 FX_DWORD len = 0;
2411 if (pLenObj && ((pLenObj->GetType() != PDFOBJ_REFERENCE) || 2411 if (pLenObj && ((pLenObj->GetType() != PDFOBJ_REFERENCE) ||
2412 ((((CPDF_Reference*)pLenObj)->GetObjList() != NULL) && 2412 ((((CPDF_Reference*)pLenObj)->GetObjList() != NULL) &&
2413 ((CPDF_Reference*)pLenObj)->GetRefObjNum() != objnum))) { 2413 ((CPDF_Reference*)pLenObj)->GetRefObjNum() != objnum))) {
2414 FX_FILESIZE pos = m_Pos;
2415 if (pLenObj) { 2414 if (pLenObj) {
2416 len = pLenObj->GetInteger(); 2415 len = pLenObj->GetInteger();
2417 } 2416 }
2418 m_Pos = pos;
2419 if (len > 0x40000000) { 2417 if (len > 0x40000000) {
2420 return NULL; 2418 return NULL;
2421 } 2419 }
2422 } 2420 }
2423 ToNextLine(); 2421 ToNextLine();
2424 FX_FILESIZE StreamStartPos = m_Pos; 2422 FX_FILESIZE StreamStartPos = m_Pos;
2425 if (pContext) { 2423 if (pContext) {
2426 pContext->m_DataStart = m_Pos; 2424 pContext->m_DataStart = m_Pos;
2427 } 2425 }
2428 m_Pos += len; 2426 m_Pos += len;
2427 if (m_Pos >= m_FileLen) {
jun_fang 2014/07/08 17:37:11 Type m_Pos: FX_FILESIZE -> FX_INT32->int m_Fil
Robert Sesek 2014/07/08 18:35:57 Done, and Chris Palmer also suggested using Checke
2428 return NULL;
2429 }
2429 CPDF_CryptoHandler* pCryptoHandler = objnum == (FX_DWORD)m_MetadataObjnum ? NULL : m_pCryptoHandler; 2430 CPDF_CryptoHandler* pCryptoHandler = objnum == (FX_DWORD)m_MetadataObjnum ? NULL : m_pCryptoHandler;
2430 if (pCryptoHandler == NULL) { 2431 if (pCryptoHandler == NULL) {
2431 FX_FILESIZE SavedPos = m_Pos; 2432 FX_FILESIZE SavedPos = m_Pos;
2432 GetNextWord(); 2433 GetNextWord();
2433 if (m_WordSize < 9 || FXSYS_memcmp32(m_WordBuffer, "endstream", 9)) { 2434 if (m_WordSize < 9 || FXSYS_memcmp32(m_WordBuffer, "endstream", 9)) {
2434 m_Pos = StreamStartPos; 2435 m_Pos = StreamStartPos;
2435 FX_FILESIZE offset = FindTag(FX_BSTRC("endstream"), 0); 2436 FX_FILESIZE offset = FindTag(FX_BSTRC("endstream"), 0);
2436 if (offset >= 0) { 2437 if (offset >= 0) {
2437 FX_FILESIZE curPos = m_Pos; 2438 FX_FILESIZE curPos = m_Pos;
2438 m_Pos = StreamStartPos; 2439 m_Pos = StreamStartPos;
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after
4380 { 4381 {
4381 FX_INT32 iSize = m_childNode.GetSize(); 4382 FX_INT32 iSize = m_childNode.GetSize();
4382 for (FX_INT32 i = 0; i < iSize; ++i) { 4383 for (FX_INT32 i = 0; i < iSize; ++i) {
4383 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4384 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4384 if (pNode) { 4385 if (pNode) {
4385 delete pNode; 4386 delete pNode;
4386 } 4387 }
4387 } 4388 }
4388 m_childNode.RemoveAll(); 4389 m_childNode.RemoveAll();
4389 } 4390 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698