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

Side by Side Diff: core/include/fpdfapi/fpdf_parser.h

Issue 875263002: Fix infinite recursion in CPDF_Parser::ParseIndirectObjectAt(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: explicit constructor. Created 5 years, 10 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 | « no previous file | core/include/fxcrt/fx_basic.h » ('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 #ifndef _FPDF_PARSER_ 7 #ifndef _FPDF_PARSER_
8 #define _FPDF_PARSER_ 8 #define _FPDF_PARSER_
9 #ifndef _FX_BASIC_H_ 9 #ifndef _FX_BASIC_H_
10 #include "../fxcrt/fx_ext.h" 10 #include "../fxcrt/fx_ext.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 FX_FILESIZE SavePos() 254 FX_FILESIZE SavePos()
255 { 255 {
256 return m_Pos; 256 return m_Pos;
257 } 257 }
258 258
259 void RestorePos(FX_FILESIZE pos) 259 void RestorePos(FX_FILESIZE pos)
260 { 260 {
261 m_Pos = pos; 261 m_Pos = pos;
262 } 262 }
263 263
264 CPDF_Object*» » GetObject(CPDF_IndirectObjects* pObjList, FX_DWO RD objnum, FX_DWORD gennum, int level, struct PARSE_CONTEXT* pContext = NULL, FX _BOOL bDecrypt = TRUE); 264 CPDF_Object*» » GetObject(CPDF_IndirectObjects* pObjList, FX_DWO RD objnum, FX_DWORD gennum, struct PARSE_CONTEXT* pContext = NULL, FX_BOOL bDecr ypt = TRUE);
265 265
266 266
267 CPDF_Object*» » GetObjectByStrict(CPDF_IndirectObjects* pObjList , FX_DWORD objnum, FX_DWORD gennum, int level, struct PARSE_CONTEXT* pContext = NULL); 267 CPDF_Object*» » GetObjectByStrict(CPDF_IndirectObjects* pObjList , FX_DWORD objnum, FX_DWORD gennum, struct PARSE_CONTEXT* pContext = NULL);
268 268
269 int GetDirectNum(); 269 int GetDirectNum();
270 270
271 CFX_ByteString GetString(FX_DWORD objnum, FX_DWORD gennum); 271 CFX_ByteString GetString(FX_DWORD objnum, FX_DWORD gennum);
272 272
273 CFX_ByteString GetName(); 273 CFX_ByteString GetName();
274 274
275 CFX_ByteString GetKeyword(); 275 CFX_ByteString GetKeyword();
276 276
277 void GetBinary(FX_BYTE* buffer, FX_DWORD size ); 277 void GetBinary(FX_BYTE* buffer, FX_DWORD size );
(...skipping 17 matching lines...) Expand all
295 { 295 {
296 return m_pCryptoHandler != NULL; 296 return m_pCryptoHandler != NULL;
297 } 297 }
298 298
299 FX_BOOL GetCharAt(FX_FILESIZE pos, FX_BYTE& ch); 299 FX_BOOL GetCharAt(FX_FILESIZE pos, FX_BYTE& ch);
300 300
301 FX_BOOL ReadBlock(FX_BYTE* pBuf, FX_DWORD size); 301 FX_BOOL ReadBlock(FX_BYTE* pBuf, FX_DWORD size);
302 302
303 CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); 303 CFX_ByteString GetNextWord(FX_BOOL& bIsNumber);
304 protected: 304 protected:
305 static const int kParserMaxRecursionDepth = 64;
306 static int s_CurrentRecursionDepth;
305 307
306 virtual FX_BOOL GetNextChar(FX_BYTE& ch); 308 virtual FX_BOOL GetNextChar(FX_BYTE& ch);
307 309
308 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, FX_BY TE& ch); 310 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, FX_BY TE& ch);
309 311
310 void GetNextWord(); 312 void GetNextWord();
311 313
312 FX_BOOL IsWholeWord(FX_FILESIZE startpos, FX_FIL ESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen); 314 FX_BOOL IsWholeWord(FX_FILESIZE startpos, FX_FIL ESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen);
313 315
314 CFX_ByteString ReadString(); 316 CFX_ByteString ReadString();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 CPDF_Object* ParseIndirectObjectAtByStrict(CPDF_IndirectObjec ts* pObjList, FX_FILESIZE pos, FX_DWORD objnum, 515 CPDF_Object* ParseIndirectObjectAtByStrict(CPDF_IndirectObjec ts* pObjList, FX_FILESIZE pos, FX_DWORD objnum,
514 struct PARSE_CONTEXT* pContext, FX_FILESIZE *pResultPos); 516 struct PARSE_CONTEXT* pContext, FX_FILESIZE *pResultPos);
515 517
516 FX_DWORD StartAsynParse(IFX_FileRead* pFile, FX_BOOL bReP arse = FALSE, FX_BOOL bOwnFileRead = TRUE); 518 FX_DWORD StartAsynParse(IFX_FileRead* pFile, FX_BOOL bReP arse = FALSE, FX_BOOL bOwnFileRead = TRUE);
517 519
518 FX_DWORD GetFirstPageNo() 520 FX_DWORD GetFirstPageNo()
519 { 521 {
520 return m_dwFirstPageNo; 522 return m_dwFirstPageNo;
521 } 523 }
522 protected: 524 protected:
523
524 CPDF_Document* m_pDocument; 525 CPDF_Document* m_pDocument;
525 526
526 CPDF_SyntaxParser m_Syntax; 527 CPDF_SyntaxParser m_Syntax;
527 FX_BOOL m_bOwnFileRead; 528 FX_BOOL m_bOwnFileRead;
528 CPDF_Object* ParseDirect(CPDF_Object* pObj); 529 CPDF_Object* ParseDirect(CPDF_Object* pObj);
529 530
530 FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); 531 FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos);
531 532
532 FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); 533 FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos);
533 534
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 PDF_DATAAVAIL_PAGETREE, 941 PDF_DATAAVAIL_PAGETREE,
941 PDF_DATAAVAIL_PAGE, 942 PDF_DATAAVAIL_PAGE,
942 PDF_DATAAVAIL_PAGE_LATERLOAD, 943 PDF_DATAAVAIL_PAGE_LATERLOAD,
943 PDF_DATAAVAIL_RESOURCES, 944 PDF_DATAAVAIL_RESOURCES,
944 PDF_DATAAVAIL_DONE, 945 PDF_DATAAVAIL_DONE,
945 PDF_DATAAVAIL_ERROR, 946 PDF_DATAAVAIL_ERROR,
946 PDF_DATAAVAIL_LOADALLFILE, 947 PDF_DATAAVAIL_LOADALLFILE,
947 PDF_DATAAVAIL_TRAILER_APPEND 948 PDF_DATAAVAIL_TRAILER_APPEND
948 }; 949 };
949 #endif 950 #endif
OLDNEW
« no previous file with comments | « no previous file | core/include/fxcrt/fx_basic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698