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

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

Issue 454283002: Fix the issue 'SEGV on unknown address in CPDF_DataAvail::GetObjectSize' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 PDF_DATAAVAIL_LOADALLFILE, 945 PDF_DATAAVAIL_LOADALLFILE,
946 PDF_DATAAVAIL_TRAILER_APPEND 946 PDF_DATAAVAIL_TRAILER_APPEND
947 }; 947 };
948 class CPDF_DataAvail FX_FINAL : public CFX_Object, public IPDF_DataAvail 948 class CPDF_DataAvail FX_FINAL : public CFX_Object, public IPDF_DataAvail
949 { 949 {
950 public: 950 public:
951 951
952 CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead); 952 CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead);
953 ~CPDF_DataAvail(); 953 ~CPDF_DataAvail();
954 954
955 virtual FX_BOOL» » » » IsDocAvail(IFX_DownloadHints* pH ints) FX_OVERRIDE; 955 virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) F X_OVERRIDE;
956 956
957 virtual void SetDocument(CPDF_Document* pDoc) FX_OVE RRIDE;
957 958
958 virtual void» » » » SetDocument(CPDF_Document* pDoc) FX_OVERRIDE; 959 virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints * pHints) FX_OVERRIDE;
959 960
961 virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) FX_OVERRIDE;
960 962
961 virtual FX_BOOL» » » » IsPageAvail(int iPage, IFX_Downl oadHints* pHints) FX_OVERRIDE; 963 virtual FX_INT32 IsLinearizedPDF() FX_OVERRIDE;
962 964
963 virtual FX_INT32» » » IsFormAvail(IFX_DownloadHints *pHints) FX_OVERRIDE; 965 virtual FX_BOOL IsLinearized() FX_OVERRIDE
964
965 virtual FX_INT32» » » IsLinearizedPDF() FX_OVERRIDE;
966
967 virtual FX_BOOL» » » » IsLinearized() FX_OVERRIDE
968 { 966 {
969 return m_bLinearized; 967 return m_bLinearized;
970 } 968 }
971 969
972 virtual void» » » » GetLinearizedMainXRefInfo(FX_FIL ESIZE *pPos, FX_DWORD *pSize) FX_OVERRIDE; 970 virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *p Pos, FX_DWORD *pSize) FX_OVERRIDE;
973 IFX_FileRead*» » » » GetFileRead() const 971 IFX_FileRead* GetFileRead() const
974 { 972 {
975 return m_pFileRead; 973 return m_pFileRead;
976 } 974 }
977 IFX_FileAvail*» » » » GetFileAvail() const 975 IFX_FileAvail* GetFileAvail() const
978 { 976 {
979 return m_pFileAvail; 977 return m_pFileAvail;
980 } 978 }
981 protected: 979 protected:
982 FX_DWORD» » » » » GetObjectSize(FX_DWORD objnum, F X_FILESIZE& offset); 980 FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESI ZE& offset);
983 FX_BOOL» » » » » » IsObjectsAvail(CFX_PtrAr ray& obj_array, FX_BOOL bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret _array); 981 FX_BOOL IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePage, IFX_DownloadHints* pHints, CFX_PtrArray &ret_array);
984 FX_BOOL» » » » » » CheckDocStatus(IFX_Downl oadHints *pHints); 982 FX_BOOL CheckDocStatus(IFX_DownloadHints *pHints );
985 FX_BOOL» » » » » » CheckHeader(IFX_Download Hints* pHints); 983 FX_BOOL CheckHeader(IFX_DownloadHints* pHints);
986 FX_BOOL» » » » » » CheckFirstPage(IFX_Downl oadHints *pHints); 984 FX_BOOL CheckFirstPage(IFX_DownloadHints *pHints );
987 FX_BOOL» » » » » » CheckEnd(IFX_DownloadHin ts *pHints); 985 FX_BOOL CheckEnd(IFX_DownloadHints *pHints);
988 FX_BOOL» » » » » » CheckCrossRef(IFX_Downlo adHints* pHints); 986 FX_BOOL CheckCrossRef(IFX_DownloadHints* pHints) ;
989 FX_BOOL» » » » » » CheckCrossRefItem(IFX_Do wnloadHints *pHints); 987 FX_BOOL CheckCrossRefItem(IFX_DownloadHints *pHi nts);
990 FX_BOOL» » » » » » CheckTrailer(IFX_Downloa dHints* pHints); 988 FX_BOOL CheckTrailer(IFX_DownloadHints* pHints);
991 FX_BOOL» » » » » » CheckRoot(IFX_DownloadHi nts* pHints); 989 FX_BOOL CheckRoot(IFX_DownloadHints* pHints);
992 FX_BOOL» » » » » » CheckInfo(IFX_DownloadHi nts* pHints); 990 FX_BOOL CheckInfo(IFX_DownloadHints* pHints);
993 FX_BOOL» » » » » » CheckPages(IFX_DownloadH ints* pHints); 991 FX_BOOL CheckPages(IFX_DownloadHints* pHints);
994 FX_BOOL» » » » » » CheckPage(IFX_DownloadHi nts* pHints); 992 FX_BOOL CheckPage(IFX_DownloadHints* pHints);
995 FX_BOOL» » » » » » CheckResources(IFX_Downl oadHints* pHints); 993 FX_BOOL CheckResources(IFX_DownloadHints* pHints );
996 FX_BOOL» » » » » » CheckAnnots(IFX_Download Hints* pHints); 994 FX_BOOL CheckAnnots(IFX_DownloadHints* pHints);
997 FX_BOOL» » » » » » CheckAcroForm(IFX_Downlo adHints* pHints); 995 FX_BOOL CheckAcroForm(IFX_DownloadHints* pHints) ;
998 FX_BOOL» » » » » » CheckAcroFormSubObject(I FX_DownloadHints* pHints); 996 FX_BOOL CheckAcroFormSubObject(IFX_DownloadHints * pHints);
999 FX_BOOL» » » » » » CheckTrailerAppend(IFX_D ownloadHints* pHints); 997 FX_BOOL CheckTrailerAppend(IFX_DownloadHints* pH ints);
1000 FX_BOOL» » » » » » CheckPageStatus(IFX_Down loadHints* pHints); 998 FX_BOOL CheckPageStatus(IFX_DownloadHints* pHint s);
1001 FX_BOOL» » » » » » CheckAllCrossRefStream(I FX_DownloadHints *pHints); 999 FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints);
1002 1000
1003 FX_DWORD» » » » » CheckCrossRefStream(IFX_Download Hints *pHints, FX_FILESIZE &xref_offset); 1001 FX_DWORD CheckCrossRefStream(IFX_DownloadHints *p Hints, FX_FILESIZE &xref_offset);
1004 FX_BOOL» » » » » » IsLinearizedFile(FX_LPBY TE pData, FX_DWORD dwLen); 1002 FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWO RD dwLen);
1005 void» » » » » » SetStartOffset(FX_FILESI ZE dwOffset); 1003 void SetStartOffset(FX_FILESIZE dwOffset);
1006 FX_BOOL» » » » » » GetNextToken(CFX_ByteStr ing &token); 1004 FX_BOOL GetNextToken(CFX_ByteString &token);
1007 FX_BOOL» » » » » » GetNextChar(FX_BYTE &ch) ; 1005 FX_BOOL GetNextChar(FX_BYTE &ch);
1008 CPDF_Object»*» » » » ParseIndirectObjectAt(FX_FILESIZ E pos, FX_DWORD objnum); 1006 CPDF_Object»* ParseIndirectObjectAt(FX_FILESIZE pos, F X_DWORD objnum);
1009 CPDF_Object»*» » » » GetObject(FX_DWORD objnum, IFX_D ownloadHints* pHints, FX_BOOL *pExistInFile); 1007 CPDF_Object»* GetObject(FX_DWORD objnum, IFX_DownloadH ints* pHints, FX_BOOL *pExistInFile);
1010 FX_BOOL» » » » » » GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages); 1008 FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_O bject *pPages);
1011 FX_BOOL» » » » » » PreparePageItem(); 1009 FX_BOOL PreparePageItem();
1012 FX_BOOL» » » » » » LoadPages(IFX_DownloadHi nts* pHints); 1010 FX_BOOL LoadPages(IFX_DownloadHints* pHints);
1013 FX_BOOL» » » » » » LoadAllXref(IFX_Download Hints* pHints); 1011 FX_BOOL LoadAllXref(IFX_DownloadHints* pHints);
1014 FX_BOOL» » » » » » LoadAllFile(IFX_Download Hints* pHints); 1012 FX_BOOL LoadAllFile(IFX_DownloadHints* pHints);
1015 FX_BOOL» » » » » » CheckLinearizedData(IFX_ DownloadHints* pHints); 1013 FX_BOOL CheckLinearizedData(IFX_DownloadHints* p Hints);
1016 FX_BOOL» » » » » » CheckFileResources(IFX_D ownloadHints* pHints); 1014 FX_BOOL CheckFileResources(IFX_DownloadHints* pH ints);
1017 FX_BOOL» » » » » » CheckPageAnnots(int iPag e, IFX_DownloadHints* pHints); 1015 FX_BOOL CheckPageAnnots(int iPage, IFX_DownloadH ints* pHints);
1018 1016
1019 FX_BOOL» » » » » » CheckLinearizedFirstPage (int iPage, IFX_DownloadHints* pHints); 1017 FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_ DownloadHints* pHints);
1020 FX_BOOL» » » » » » HaveResourceAncestor(CPD F_Dictionary *pDict); 1018 FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pD ict);
1021 FX_BOOL» » » » » » CheckPage(FX_INT32 iPage , IFX_DownloadHints* pHints); 1019 FX_BOOL CheckPage(FX_INT32 iPage, IFX_DownloadHi nts* pHints);
1022 FX_BOOL» » » » » » LoadDocPages(IFX_Downloa dHints* pHints); 1020 FX_BOOL LoadDocPages(IFX_DownloadHints* pHints);
1023 FX_BOOL» » » » » » LoadDocPage(FX_INT32 iPa ge, IFX_DownloadHints* pHints); 1021 FX_BOOL LoadDocPage(FX_INT32 iPage, IFX_Download Hints* pHints);
1024 FX_BOOL» » » » » » CheckPageNode(CPDF_PageN ode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints); 1022 FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints);
1025 FX_BOOL» » » » » » CheckUnkownPageNode(FX_D WORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); 1023 FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, C PDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
1026 FX_BOOL» » » » » » CheckArrayPageNode(FX_DW ORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints); 1024 FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, CP DF_PageNode *pPageNode, IFX_DownloadHints* pHints);
1027 FX_BOOL CheckPageCount(IFX_DownloadHints* pHints); 1025 FX_BOOL CheckPageCount(IFX_DownloadHints* pHints );
1028 FX_BOOL» » » » » » IsFirstCheck(int iPage); 1026 FX_BOOL IsFirstCheck(int iPage);
1029 void» » » » » » ResetFirstCheck(int iPag e); 1027 void ResetFirstCheck(int iPage);
1030 1028
1031 CPDF_Parser»» » » m_parser; 1029 CPDF_Parser m_parser;
1032 1030
1033 CPDF_SyntaxParser» » m_syntaxParser; 1031 CPDF_SyntaxParser m_syntaxParser;
1034 1032
1035 CPDF_Object»» » » *m_pRoot; 1033 CPDF_Object *m_pRoot;
1036 1034
1037 FX_DWORD» » » » m_dwRootObjNum; 1035 FX_DWORD m_dwRootObjNum;
1038 1036
1039 FX_DWORD» » » » m_dwInfoObjNum; 1037 FX_DWORD m_dwInfoObjNum;
1040 1038
1041 CPDF_Object»» » » *m_pLinearized; 1039 CPDF_Object *m_pLinearized;
1042 1040
1043 CPDF_Object»» » » *m_pTrailer; 1041 CPDF_Object *m_pTrailer;
1044 1042
1045 FX_BOOL» » » » » m_bDocAvail; 1043 FX_BOOL m_bDocAvail;
1046 1044
1047 FX_FILESIZE»» » » m_dwHeaderOffset; 1045 FX_FILESIZE m_dwHeaderOffset;
1048 1046
1049 FX_FILESIZE»» » » m_dwLastXRefOffset; 1047 FX_FILESIZE m_dwLastXRefOffset;
1050 1048
1051 FX_FILESIZE»» » » m_dwXRefOffset; 1049 FX_FILESIZE m_dwXRefOffset;
1052 1050
1053 FX_FILESIZE»» » » m_dwTrailerOffset; 1051 FX_FILESIZE m_dwTrailerOffset;
1054 1052
1055 FX_FILESIZE»» » » m_dwCurrentOffset; 1053 FX_FILESIZE m_dwCurrentOffset;
1056 1054
1057 PDF_DATAAVAIL_STATUS» m_docStatus; 1055 PDF_DATAAVAIL_STATUS m_docStatus;
1058 1056
1059 IFX_FileAvail*» » » m_pFileAvail; 1057 IFX_FileAvail* m_pFileAvail;
1060 1058
1061 IFX_FileRead*» » » m_pFileRead; 1059 IFX_FileRead* m_pFileRead;
1062 1060
1063 FX_FILESIZE»» » » m_dwFileLen; 1061 FX_FILESIZE» m_dwFileLen;
1064 1062
1065 CPDF_Document*» » » m_pDocument; 1063 CPDF_Document* m_pDocument;
1066 1064
1067 CPDF_SortObjNumArray» m_objnum_array; 1065 CPDF_SortObjNumArray m_objnum_array;
1068 1066
1069 CFX_PtrArray» » » m_objs_array; 1067 CFX_PtrArray m_objs_array;
1070 1068
1071 FX_FILESIZE»» » » m_Pos; 1069 FX_FILESIZE» m_Pos;
1072 1070
1073 FX_FILESIZE»» » » m_bufferOffset; 1071 FX_FILESIZE m_bufferOffset;
1074 1072
1075 FX_DWORD» » » » m_bufferSize; 1073 FX_DWORD m_bufferSize;
1076 1074
1077 CFX_ByteString» » » m_WordBuf; 1075 CFX_ByteString m_WordBuf;
1078 1076
1079 FX_BYTE» » » » » m_WordBuffer[257]; 1077 FX_BYTE m_WordBuffer[257];
1080 1078
1081 FX_DWORD» » » » m_WordSize; 1079 FX_DWORD m_WordSize;
1082 1080
1083 FX_BYTE» » » » » m_bufferData[512]; 1081 FX_BYTE m_bufferData[512];
1084 1082
1085 CFX_FileSizeArray» » m_CrossOffset; 1083 CFX_FileSizeArray m_CrossOffset;
1086 1084
1087 CFX_DWordArray» » » m_XRefStreamList; 1085 CFX_DWordArray m_XRefStreamList;
1088 1086
1089 CFX_DWordArray» » » m_PageObjList; 1087 CFX_DWordArray m_PageObjList;
1090 1088
1091 FX_DWORD» » » » m_PagesObjNum; 1089 FX_DWORD m_PagesObjNum;
1092 1090
1093 FX_BOOL» » » » » m_bLinearized; 1091 FX_BOOL m_bLinearized;
1094 1092
1095 FX_DWORD» » » » m_dwFirstPageNo; 1093 FX_DWORD m_dwFirstPageNo;
1096 1094
1097 FX_BOOL» » » » » m_bLinearedDataOK; 1095 FX_BOOL m_bLinearedDataOK;
1098 1096
1099 FX_BOOL» » » » » m_bMainXRefLoad; 1097 FX_BOOL m_bMainXRefLoadTried;
1100 1098
1101 FX_BOOL» » » » » m_bMainXRefLoadedOK; 1099 FX_BOOL m_bMainXRefLoadedOK;
1102 1100
1103 FX_BOOL» » » » » m_bPagesTreeLoad; 1101 FX_BOOL m_bPagesTreeLoad;
1104 1102
1105 FX_BOOL» » » » » m_bPagesLoad; 1103 FX_BOOL m_bPagesLoad;
1106 1104
1107 CPDF_Parser *» » » m_pCurrentParser; 1105 CPDF_Parser * m_pCurrentParser;
1108 1106
1109 FX_FILESIZE»» » » m_dwCurrentXRefSteam; 1107 FX_FILESIZE m_dwCurrentXRefSteam;
1110 1108
1111 FX_BOOL» » » » » m_bAnnotsLoad; 1109 FX_BOOL m_bAnnotsLoad;
1112 1110
1113 FX_BOOL» » » » » m_bHaveAcroForm; 1111 FX_BOOL m_bHaveAcroForm;
1114 1112
1115 FX_DWORD» » » » m_dwAcroFormObjNum; 1113 FX_DWORD m_dwAcroFormObjNum;
1116 1114
1117 FX_BOOL» » » » » m_bAcroFormLoad; 1115 FX_BOOL m_bAcroFormLoad;
1118 1116
1119 CPDF_Object»*» » » m_pAcroForm; 1117 CPDF_Object»* m_pAcroForm;
1120 1118
1121 CFX_PtrArray» » » m_arrayAcroforms; 1119 CFX_PtrArray m_arrayAcroforms;
1122 1120
1123 CPDF_Dictionary *» » m_pPageDict; 1121 CPDF_Dictionary * m_pPageDict;
1124 1122
1125 CPDF_Object *» » » m_pPageResource; 1123 CPDF_Object * m_pPageResource;
1126 1124
1127 FX_BOOL» » » » » m_bNeedDownLoadResource; 1125 FX_BOOL m_bNeedDownLoadResource;
1128 1126
1129 FX_BOOL» » » » » m_bPageLoadedOK; 1127 FX_BOOL m_bPageLoadedOK;
1130 1128
1131 FX_BOOL» » » » » m_bLinearizedFormParamLoad; 1129 FX_BOOL m_bLinearizedFormParamLoad;
1132 1130
1133 CFX_PtrArray» » » m_PagesArray; 1131 CFX_PtrArray m_PagesArray;
1134 1132
1135 FX_DWORD» » » » m_dwEncryptObjNum; 1133 FX_DWORD m_dwEncryptObjNum;
1136 1134
1137 FX_FILESIZE»» » » m_dwPrevXRefOffset; 1135 FX_FILESIZE m_dwPrevXRefOffset;
1138 1136
1139 FX_BOOL» » » » » m_bTotalLoadPageTree; 1137 FX_BOOL m_bTotalLoadPageTree;
1140 1138
1141 FX_BOOL» » » » » m_bCurPageDictLoadOK; 1139 FX_BOOL m_bCurPageDictLoadOK;
1142 1140
1143 CPDF_PageNode» » » m_pageNodes; 1141 CPDF_PageNode m_pageNodes;
1144 1142
1145 CFX_CMapDWordToDWord *» m_pageMapCheckState; 1143 CFX_CMapDWordToDWord * m_pageMapCheckState;
1146 1144
1147 CFX_CMapDWordToDWord *» m_pagesLoadState; 1145 CFX_CMapDWordToDWord * m_pagesLoadState;
1148 }; 1146 };
1149 #endif 1147 #endif
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698