summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser
AgeCommit message (Collapse)Author
2016-08-29Initialize the CPDF_Document pointerdsinclair
This CL is a speculative fix for the associated BUG. Make sure the CPDF_Document is initialized in the constructor. BUG=chromium:640998 Review-Url: https://codereview.chromium.org/2291743002
2016-08-29Add some limit checks to ReadSharedObjHintTable().thestig
BUG=641444 Review-Url: https://codereview.chromium.org/2283893003
2016-08-25Check for nullptrs in CPDF_Dictionary dtor.thestig
BUG=597440 Review-Url: https://codereview.chromium.org/2273293003
2016-08-24Removing CPDF_Parser::CloseParser.chromium/2839dsinclair
Currently the only calls to CloseParser() happend in the destructor or the start*Parse methods. The Start*Parse methods are currently only called on freshly constructed parsers in fpdf_dataavail and fpdfview. This CL removes the CloseParser() method and puts the contents in the destructor. We then add an ASSERT that we don't re-enter the parser after it has already completed the parse. Review-Url: https://codereview.chromium.org/2267173005
2016-08-24Flip document and parser ownershipdsinclair
This Cl switches the ownership between the parser and the document. Previously the parser owned the document and we'd jump through hoops during cleanup to delete the right object. This Cl flips the ownership so the document owns the parser and simplifies the cleanup logic where needed. BUG=pdfium:565 Review-Url: https://codereview.chromium.org/2275773003
2016-08-24Move parser out of IndirectObjectHolderdsinclair
This Cl moves the parser out of the indirect object holder and into the CPDF_Document where it is used. Review-Url: https://codereview.chromium.org/2277433003
2016-08-23Fix stack overflow in object Clone() functionsweili
For some complex objects such as CPDF_Dictionary, CPDF_Array, CPDF_Stream, and CPDF_Reference, Clone() could be executed with infinite recursion to cause the stack overflow. Fix this by checking already cloned objects to avoid recursion. BUG=pdfium:513 Review-Url: https://codereview.chromium.org/2250533002
2016-08-23Make indirect object holder private.dsinclair
This CL moves the m_IndirectObjs map to be private to the IndirectObjectHolder. Various bits of code have been updated to use the accessors to the map. This CL fixes the issue with the last time this landed by removing the objnum check from GetIndirectObject() which appears to have caused the crashes. Review-Url: https://codereview.chromium.org/2275703002
2016-08-23IndirectObjectHolder API updatesdsinclair
This Cl updates the names of the methods in the indirect object holder to better reflect their usage. The m_LastObjNum is made private and a setter added. Review-Url: https://codereview.chromium.org/2275593002
2016-08-23Fix one more integer overflow in ReadPageHintTable().thestig
BUG=637119 Review-Url: https://codereview.chromium.org/2274723002
2016-08-22Fix more integer overflows inside ReadPageHintTable().thestig
BUG=637119 Review-Url: https://codereview.chromium.org/2268693003
2016-08-22Revert of Move parser pointer to CPDF_Document (patchset #6 id:100001 of ↵dsinclair
https://codereview.chromium.org/2253723002/ ) Reason for revert: Causing asan issues. See crbug.com/639451. Original issue's description: > Move parser pointer to CPDF_Document > > The CPDF_IndirectObjectHolder has two subclasses, CPDF_Document and > CFDF_Document. The CPDF document requires the parser and the CFDF document > does not. This cl moves the parser pointer up to CPDF_Document. > > Committed: https://pdfium.googlesource.com/pdfium/+/260f5fbf3553a96fa49b029cc050220039c30e2a TBR=tsepez@chromium.org,thestig@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. Review-Url: https://codereview.chromium.org/2266033002
2016-08-19Add a fuzzer for CPDF_HintTables.thestig
BUG=636559 Review-Url: https://codereview.chromium.org/2255083004
2016-08-18Move CFX_UnicodeEncoding and CFX_UnicodeEncodingEx to their own files.npm
Review-Url: https://codereview.chromium.org/2260533002
2016-08-17Split fx_font into multiple files, part 1.npm
Moved classes CFX_FontCache and CFX_AutoFontCache into a separate file. Review-Url: https://codereview.chromium.org/2246223002
2016-08-17Move parser pointer to CPDF_Documentdsinclair
The CPDF_IndirectObjectHolder has two subclasses, CPDF_Document and CFDF_Document. The CPDF document requires the parser and the CFDF document does not. This cl moves the parser pointer up to CPDF_Document. Review-Url: https://codereview.chromium.org/2253723002
2016-08-16Remove two unused members from CPDF_Parsertsepez
Review-Url: https://codereview.chromium.org/2247073005
2016-08-16Rename async to linearized when parsingdsinclair
The parser and document refer to async loading and parsing. The code isn't actually async but loading a linearized PDF. This Cl renames the methods to clarify what the code is doing. The LoadDoc() and LoadLinearizedDoc() methods have been refactored to share a common LoadDocInternal() method. Review-Url: https://codereview.chromium.org/2250163002
2016-08-16Get CPDF_Parser out of the document creation business.tsepez
Precursor to someday using possibly subclassed documents. Review-Url: https://codereview.chromium.org/2248123002
2016-08-15Clean up CPDF_HintTables.thestig
Review-Url: https://codereview.chromium.org/2241153002
2016-08-12Avoid an undefined shift in ReadPageHintTable().thestig
Even 39 bits is very generous for the number of bits needed to represent the greatest number of shared object references. BUG=637119 Review-Url: https://codereview.chromium.org/2242723002
2016-08-11Relax a check in CPDF_HintTables.thestig
CPDF_HintTables::ReadSharedObjHintTable() unnecessarily constraints a FX_FILESIZE value to an int32_t. Relax this check, since the result will be stored in |m_szSharedObjOffsetArray| which is of FX_FILESIZE. Bad values in |m_szSharedObjOffsetArray| will still cause hint table loading to eventually fail. BUG=635565 Review-Url: https://codereview.chromium.org/2230883003
2016-08-10Clean up CPDF_HintTables::LoadHintStream a little.thestig
- Return earlier when possible. - Fail rather than crash on invalid values. Review-Url: https://codereview.chromium.org/2235843002
2016-08-08Add CPDF_Array::IsEmpty().jaepark
Using IsEmpty() is more readable than using GetCount() == 0. Review-Url: https://codereview.chromium.org/2226113002
2016-08-02Fixup crypto key generation.dsinclair
This CL fixes up the crypto key copying code to better handle big endian machines. BUG=pdfium:147 Review-Url: https://codereview.chromium.org/2190123002
2016-07-29Cleanup CPDF_DocPageData release methods and callers.thestig
Review-Url: https://codereview.chromium.org/2194853002
2016-07-28Split fpdfdoc/include/fpdf_doc.h into individual classes.dsinclair
This CL splits the header file apart. The cpp files are not touched as part of this CL, they will be done as a followup. This de-duplicates the fpdf_doc.h BUG=pdfium:249 Review-Url: https://codereview.chromium.org/2183313004
2016-07-24Remove CFX_Deletableweili
Change the last use of CFX_Deletable to its actual type and remove the use of CFX_Deletable. Review-Url: https://codereview.chromium.org/2178613002
2016-07-15Use CPDF_Dictionary::SetAtReference instead of CPDF_Dictionary::AddReference.jaepark
The definitions of CPDF_Dictionary::SetAtReference and CPDF_Dictionary::AddReference are identical, and AddReference is only used once. So remove CPDF_Dictionary::AddReference method and use CPDF_Dictionary::SetAtReference instead. Review-Url: https://codereview.chromium.org/2161453002
2016-07-11Use smart pointers for class owned member variablesweili
Replace raw member variables to smart pointer type to better maintain the ownership and to ease the management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2136683002
2016-06-23Improve hint table validation checks.thestig
Check required hint table dictionary entries and make sure they: - Exist. - Are of the right type. Along the way: - Fix FX_atonum() to not have a non-const pass-by-ref param. - Simplify code in CPDF_StreamContentParser. - Make CPDF_Number::IsInteger() a const method. BUG=610555 Review-Url: https://codereview.chromium.org/2095763003
2016-06-22Fix memory leaks in EmbedderTest::OpenDocument().thestig
EmbedderTest::OpenDocument() does not gracefully handle the case of being called twice in a given test case. So avoid doing that. Review-Url: https://codereview.chromium.org/2088093002
2016-06-21Use FXFONT defines in place of integers.thestig
Fix nits along the way. Review-Url: https://codereview.chromium.org/2083943003
2016-06-14Get rid of IPDF_DataAvail.thestig
BUG=pdfium:520 Review-Url: https://codereview.chromium.org/2061973002
2016-06-13Make code compile with clang_use_chrome_plugin (part I)weili
This change contains files in core/fpdfapi directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2060973002
2016-06-08Set data availablity error.dsinclair
If we have been told we have a hint table, but fail to read the table, set the document status to error instead of just returning. BUG=pdfium:512 Review-Url: https://codereview.chromium.org/2040373003
2016-06-07Get rid of NULLs in core/thestig
Review-Url: https://codereview.chromium.org/2032613003
2016-06-07Check the hint table exists before using.dsinclair
It's possible for the hint table to not exist event though we have a hint key in the object database. If the table does not exist then return false from CheckHIntTables(). BUG=pdfium:512 Review-Url: https://codereview.chromium.org/2047723002
2016-06-07Add missing const to CPDF_Stream::InitStream()tsepez
Review-Url: https://codereview.chromium.org/2044453003
2016-06-06Remove unused PS generation code.thestig
CFX_PSRenderer, IFX_PSOutput, CPSOutput, CPSPrinterDriver. Also reland commit 2d63eaa. Review-Url: https://codereview.chromium.org/2019603002
2016-06-03Fix more bugs found by /analyze toolweili
Three more bugs are discovered: -- potientially used freed pointer; -- potientially used uninitialized variable; -- Used '&&' instead of bitwise operator '&' BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2040503002
2016-06-03Fix some code which causes warnings when compiled by /analyze toolweili
The code may not cause error conditions, but can be improved. These warnings include uninitialized variables, signed/unsigned mismatch, redundant condition, and using bool in arithmetic operations. Also remove a chunk of unused code. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2036203004
2016-06-02Fix all the code which has duplicate variable declarationsweili
When there are duplicate variable declarations, the inner names shadow the outter ones. This is error prone and harder to read. Remove all the instances found by /analyze. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2027273002
2016-05-26Make CPDF_IndirectObjectHolder::InsertIndirectObject return a bool.thestig
Fix some nits in CPDF_Parser::LoadCrossRefV5() and other callers. Review-Url: https://codereview.chromium.org/2019443002
2016-05-25Remove CFX_PrivateData from CPDF_Documenttsepez
Replace it with two generic slots for Links and Codec usage. Since the codec is at a lower layer than the document, we don't provide separate get/set methods, since having a document upon which to call these would be a layering violation. Do the same for the Links for simplicity. Review-Url: https://codereview.chromium.org/2005193003
2016-05-23Change CPDF_Boolean to use bool instead of FX_BOOL.thestig
Review-Url: https://codereview.chromium.org/1999313002
2016-05-23Distinguish between user and owner passwords.thestig
BUG=pdfium:496 Review-Url: https://codereview.chromium.org/2005653002
2016-05-23Delete CPDF_Object::IsModified().thestig
Review-Url: https://codereview.chromium.org/2001933002
2016-05-23Fix infinite recursion in CPDF_DocPageData::GetColorSpace().thestig
BUG=pdfium:497 Review-Url: https://codereview.chromium.org/2003873002
2016-05-21Get rid of CPDF_Object::GetArray().thestig
BUG=pdfium:234 Review-Url: https://codereview.chromium.org/2001783003