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

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

Issue 1504513002: Fix an incorrect check in CPDF_DataAvail::CheckHintTables. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: simplify logic Created 5 years 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 "parser_int.h" 7 #include "parser_int.h"
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 3581 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 m_docStatus = PDF_DATAAVAIL_ERROR; 3592 m_docStatus = PDF_DATAAVAIL_ERROR;
3593 return FALSE; 3593 return FALSE;
3594 } 3594 }
3595 if (!IsDataAvail(szHSStart, szHSLength, pHints)) { 3595 if (!IsDataAvail(szHSStart, szHSLength, pHints)) {
3596 return FALSE; 3596 return FALSE;
3597 } 3597 }
3598 m_syntaxParser.InitParser(m_pFileRead, m_dwHeaderOffset); 3598 m_syntaxParser.InitParser(m_pFileRead, m_dwHeaderOffset);
3599 nonstd::unique_ptr<CPDF_HintTables> pHintTables( 3599 nonstd::unique_ptr<CPDF_HintTables> pHintTables(
3600 new CPDF_HintTables(this, pDict)); 3600 new CPDF_HintTables(this, pDict));
3601 CPDF_Stream* pHintStream = (CPDF_Stream*)ParseIndirectObjectAt(szHSStart, 0); 3601 CPDF_Stream* pHintStream = (CPDF_Stream*)ParseIndirectObjectAt(szHSStart, 0);
3602 FX_BOOL bLoaded = FALSE; 3602 if (pHintStream && pHintStream->GetType() == PDFOBJ_STREAM &&
3603 if (pHintTables && pHintStream && pHintStream->GetType() == PDFOBJ_STREAM) { 3603 pHintTables->LoadHintStream(pHintStream))
3604 bLoaded = pHintTables->LoadHintStream(pHintStream);
3605 }
3606 if (!bLoaded) {
3607 m_pHintTables.reset(pHintTables.release()); 3604 m_pHintTables.reset(pHintTables.release());
3608 } 3605
3609 m_docStatus = PDF_DATAAVAIL_DONE; 3606 m_docStatus = PDF_DATAAVAIL_DONE;
3610 return TRUE; 3607 return TRUE;
3611 } 3608 }
3612 CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( 3609 CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
3613 FX_FILESIZE pos, 3610 FX_FILESIZE pos,
3614 FX_DWORD objnum, 3611 FX_DWORD objnum,
3615 CPDF_IndirectObjects* pObjList) { 3612 CPDF_IndirectObjects* pObjList) {
3616 FX_FILESIZE SavedPos = m_syntaxParser.SavePos(); 3613 FX_FILESIZE SavedPos = m_syntaxParser.SavePos();
3617 m_syntaxParser.RestorePos(pos); 3614 m_syntaxParser.RestorePos(pos);
3618 FX_BOOL bIsNumber; 3615 FX_BOOL bIsNumber;
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
4941 if (!m_pLinearizedDict) 4938 if (!m_pLinearizedDict)
4942 return -1; 4939 return -1;
4943 CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H")); 4940 CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H"));
4944 if (!pRange) 4941 if (!pRange)
4945 return -1; 4942 return -1;
4946 CPDF_Object* pStreamLen = pRange->GetElementValue(1); 4943 CPDF_Object* pStreamLen = pRange->GetElementValue(1);
4947 if (!pStreamLen) 4944 if (!pStreamLen)
4948 return -1; 4945 return -1;
4949 return pStreamLen->GetInteger(); 4946 return pStreamLen->GetInteger();
4950 } 4947 }
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