summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
AgeCommit message (Collapse)Author
2016-02-01Merge to XFA: Remove the m_V5Type member variable from CPDF_Parser.chromium/2641chromium/2640chromium/2639chromium/2638Lei Zhang
Use the type field in the m_ObjectInfo map instead. BUG=pdfium:111 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1650793002 . (cherry picked from commit 93c196d868535f684007a7d3ed1f7146851a0ab9) Review URL: https://codereview.chromium.org/1652083004 .
2016-01-29Another round of cleanup in CPDF_Parser and friends.Lei Zhang
- Remove dead code. - Add more public methods and remove friends. TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1566133002 . (cherry picked from commit 9e8185948f7631515951770ca8778f42cc9fd2fc) Review URL: https://codereview.chromium.org/1649233002 .
2016-01-29Merge to XFA: Member function name refactoringWei Li
This is needed by Cl 1634373003 as the name collision with virtual functions will be shown as warnings on Linux. Also, it is better to use different names for different cases. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1644633003 . (cherry picked from commit d45e7a51904164fb22049f0a7a80d2a94c06936b) Review URL: https://codereview.chromium.org/1648233002 .
2016-01-26War on #defines - part 2Tom Sepez
Introduce CPDF_Parser::Error. Introduce CPDF_Color::Type. Unused XFA_DATASETS and XFA_FORMS defines. Move FPDF_CreateStandardSecurityHandler() prototype to header. Delete prototype for nonexistent FPDF_CreatePubKeyHandler(). Make PBS_* defines local to .cpp file. Tidy whitespace. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1634123004 .
2016-01-26Merge to XFA: Move struct ContentParam off of CPDF_Object's enumsTom Sepez
Original Review URL: https://codereview.chromium.org/1635173003 . (cherry picked from commit 0ec8bb4486ab315283f36d071be2ddc1b80998c3) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1636133002 .
2016-01-26Merge to XFA: War on #defines, part 1.Tom Sepez
Contains additional XFA-specific changes. Original Review URL: https://codereview.chromium.org/1632143002 . (cherry picked from commit 66a9dc9dd65ed2b9c7ede448d046b770140f16d5) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1636503006 .
2016-01-25Remove several more unused parser values.Tom Sepez
unused progressive enum unused members m_bFileStream, m_dwWordPos Remove PDFWORD_* types R=thestig@chromium.org Review URL: https://codereview.chromium.org/1634683003 .
2016-01-25Remove struct PARSE_OPTIONS.Tom Sepez
Its members are assigned to, but never used in any calculations (besides for other members). R=thestig@chromium.org Review URL: https://codereview.chromium.org/1630973002 .
2016-01-25Remove unused IsContentUsedElsewhere()Tom Sepez
Then CPDF_Object::GetDirectType() becomes unused. Then GetIndirectType() becomes unused. Then PDFPARSE_TYPEONLY becomes unused. Then we can remove hideous casts of ints to ptrs. Also, PDFPARSE_NOSTREAM is unused. Then we can remove m_Flags from PARSE_CONTEXT. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1638493002 .
2016-01-20Merge to XFA: Replace more CFX_MapPtrToPtr.Tom Sepez
Original Review URL: https://codereview.chromium.org/1580573002 . (cherry picked from commit a505d9d3e13485e090e50d5d83f882fb707d3f48) R=ochang@chromium.org Review URL: https://codereview.chromium.org/1610163003 .
2016-01-14Merge to XFA: Loose checking for trailer's size fieldWei Li
Although trailer's size value is required by spec, other readers such as Acrobat or libpoppler can handle without it. Loose up the check to be more tolerant. BUG=pdfium:213 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1582193002 . (cherry picked from commit 34291b900ad0472eef582215cfce0d942a40fd16) Review URL: https://codereview.chromium.org/1589783004 .
2016-01-14Merge to XFA: Correct the way to count pages and to avoid infinite loopWei Li
BUG=pdfium:360 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1585823003 . (cherry picked from commit 5d5d9fe7bd1c9566b9d6570015b7c60894d9fc0c) Review URL: https://codereview.chromium.org/1583073004 .
2016-01-13Merge to XFA: Fix some iterator invalidation issues while traversing ↵Oliver Chang
CPDF_Dictionary. Also fixes a potential issue in CPDF_Dictionary::ReplaceKey. TBR=thestig@chromium.org BUG=577030 Original Review URL: https://codereview.chromium.org/1582963003 . (cherry picked from commit cae57daaa0f7ed4c92e22c4e7ef30392393d1128) Review URL: https://codereview.chromium.org/1587703003 .
2016-01-13Merge to XFA: Fix out of bound access in CPDF_Parser::ParseIndirectObject().Lei Zhang
This regressed in commit f6dafc9. BUG=576915 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1582763002 . (cherry picked from commit e02f30bb59b01c159b010fc5c6bb55e677aba8ce) Review URL: https://codereview.chromium.org/1584663003 .
2016-01-13Merge to XFA: Use the compiler to type check DocAvailStatus return values.Lei Zhang
TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1575363007 . (cherry picked from commit 2fa5c7a8b6602bb2fe1df7cd09b12de666ca8a0a) Review URL: https://codereview.chromium.org/1585773002 .
2016-01-12Merget to XFA: Use std::map in CPDF_IndirectObjectsTom Sepez
Review URL: https://codereview.chromium.org/1576113003 . (cherry picked from commit fce548047a44c7015996874452f3e778bf64cad6) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1579693004 .
2016-01-11Merge to XFA: Fix an infinite loop parsing in CPDF_SyntaxParser::GetObject()Wei Li
CPDF_SyntaxParser::GetObject() may enter into an infinite loop when a signature dictionary doesn't have 'Contents' field. Add a check to avoid that. BUG=pdfium:344 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1575833004 . (cherry picked from commit d3ab0f383f6736657480a8bb418c5e715a1aed3b) Review URL: https://codereview.chromium.org/1571333004 .
2016-01-11Merge to XFA: Use std::map as CPDF_Dictionary's underlying store.Oliver Chang
Replaces CFX_CMapByteStringToPtr. XFA still uses CFX_CMapByteStringToPtr so it's not completely removed just yet. Adds begin()/end() to CPDF_Dictionary and removes the GetStartPos()/GetNextElement() functions to traverse the dictionary. Callers are changed accordingly. AddValue() is also removed. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1541703003 . (cherry picked from commit 14f39950451bb9c2a11fbc7173fd47367410f80f) Review URL: https://codereview.chromium.org/1576033002 .
2016-01-08Merge to XFA: Fix infinite loop caused by parsing same indirect objectsWei Li
BUG=pdfium:343 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1569343002 . (cherry picked from commit 149f1db8bba85bdf2b40d330c38f2478695ca0d5) Review URL: https://codereview.chromium.org/1575663002 .
2016-01-08Merge to XFA: Clean up misc nits found while fixing bugs.Lei Zhang
Some bits regressed in commit 338805f. Also merge: IWYU fix after commit c5a8933. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1544963002 . Review URL: https://codereview.chromium.org/1570973002 . (cherry picked from commit c5a8933f260ca1034fde902058442984e55c0f7a) (cherry picked from commit e6bd31873c3dba3f79c5ebbbefed636948629cc9) Review URL: https://codereview.chromium.org/1577453002 .
2016-01-07Cleanup includes, comments, and unused codeWei Li
TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1563673002 . (cherry picked from commit 6664977832350e4a9717bd67b09e3d01196791ba) Review URL: https://codereview.chromium.org/1568923002 .
2016-01-06Merge to XFA: Change CPDF_SyntaxParser::GetNextWord() to not pass by ↵Lei Zhang
non-const ref. Change the internal version to GetNextWordInternal(). TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1558083002 . (cherry picked from commit 61197421793e24add7a250d3f15ab83dc75f80c6) Review URL: https://codereview.chromium.org/1561093002 .
2016-01-05Merge to XFA: Replace CPDF_SortObjNumArray with a std::set.Lei Zhang
R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1566553002 . (cherry picked from commit 6caae4d3c6815c5a1e12340734412a3bc7548652) Review URL: https://codereview.chromium.org/1561853002 .
2016-01-05Merge to XFA: Fix a few uses of default arguments.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1555293002 . (cherry picked from commit dbfaa8d11404a53b4807b3dbd0185047367bbff6) Review URL: https://codereview.chromium.org/1565603002 .
2016-01-05Merge to XFA: Fix an infinite loop in CPDF_Parser::RebuildCrossRef().Lei Zhang
BUG=pdfium:325 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1543043003 . (cherry picked from commit 2d88e91ca5538470c9f4bc098e7f1f1ea9013c37) Review URL: https://codereview.chromium.org/1560903002 .
2016-01-05Merge to XFA: Make more CPDF_Parser method const.Lei Zhang
TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1549103002 . (cherry picked from commit a3235d0f5ca92c89b1de0f135a05e9891e499fb9) Review URL: https://codereview.chromium.org/1560183003 .
2016-01-05Merge to XFA: Exit infinite loops for cross reference loadingWei Li
When cross reference sections form a loop, our code will enter an infinite loop. Add detection and exit code for v4 cross reference loading. V5 loading was done previously. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1558093002 . (cherry picked from commit aab8f462ea3368ed4825172231131e1a10db978d) Review URL: https://codereview.chromium.org/1556423002 .
2015-12-24Merge to XFA: Fix another regression from commit f6dafc9.Lei Zhang
TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1548963004 . (cherry picked from commit b43b8859153e129053f3fa790c182fa04c3336db) Review URL: https://codereview.chromium.org/1549963002 .
2015-12-24Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr.Lei Zhang
TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1547833002 . (cherry picked from commit d20dfba2ae10e8aeb328328f09da79ff904110a8) Review URL: https://codereview.chromium.org/1545183002 .
2015-12-24Merge to XFA: Call CheckLinearizedFirstPage() when loading the first ↵Lei Zhang
linearized page. Otherwise CheckLinearizedFirstPage() has no other callers. BUG=pdfium:330 TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1543193002 . (cherry picked from commit bab9a98b71f351cf9f4eb39138bca55e3be4ef15) Review URL: https://codereview.chromium.org/1543353002 .
2015-12-22Merge to XFA: Start using allowed C++11 features.Lei Zhang
TBR=dml@google.com, thakis@chromium.org Review URL: https://codereview.chromium.org/1544923002 . Review URL: https://codereview.chromium.org/1545823002 . (cherry picked from commit ba2586d2c0a50df14aa2549a0a841e1d4b9af4b6) (cherry picked from commit 87f7d29531dabfd66e547a6be31a08272ff631d5) Review URL: https://codereview.chromium.org/1542213002 .
2015-12-22Merge to XFA: Add ContainsKey() and ContainsValue() and use them where ↵Lei Zhang
appropriate. TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1540263003 . (cherry picked from commit 1fc92867ca53f0fba4272fbee3814d844f487495) Review URL: https://codereview.chromium.org/1542193002 .
2015-12-22Merge to XFA: Convert CPDF_Parser::m_CrossRef to a std::map.Lei Zhang
This improvements memory usage in case PDFs have sparse object numbers. The map holds a struct that currently has only one member. The struct will contain more members as other internal data structures get converted. BUG=pdfium:111 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1539573003 . (cherry picked from commit f6dafc90ec1a0df8d618efc68c0223f0cdd80ffb) Review URL: https://codereview.chromium.org/1544913002 .
2015-12-18Merge to XFA: Get rid of a few CPDF_Object Create() methods and just use new ↵Lei Zhang
instead. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1540693002 . (cherry picked from commit d866ab0b44a571c884fdd8ba5a5319adaf607559) Review URL: https://codereview.chromium.org/1541563002 .
2015-12-18Merge to XFA: Fix a memory leak in CPDF_DataAvail::CheckHintTablesOliver Chang
R=thestig@chromium.org TBR=thestig@chromium.org BUG=pdfium:327 Original Review URL: https://codereview.chromium.org/1536113002 . (cherry picked from commit 6287ebc38e5aafc256b6248caae710ea09d0ede4) Review URL: https://codereview.chromium.org/1537123002 .
2015-12-18Merge to XFA: Correct return values in CPDF_HintTables::CheckPage()Jun Fang
BUG=pdfium:329 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1529173005 . Review URL: https://codereview.chromium.org/1535753003 .
2015-12-15Merge to XFA: Fix free entry handling for cross reference v4 reading.Wei Li
While reading free entries in v4 cross reference table, changing the start_objnum caused crossref table built wrong. BUG=569795 TBR=jun_fang@foxitsoftware.com, thestig@chromium.org Review URL: https://codereview.chromium.org/1527823003 . (cherry picked from commit c89cd979fb8654d85b822909cba9263d5f13760c) Review URL: https://codereview.chromium.org/1528153003 .
2015-12-14Merge to XFA: Get rid of most instance of 'foo == NULL'Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1520063002 . (cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff) Review URL: https://codereview.chromium.org/1528763003 .
2015-12-14Merge to XFA: Remove FX_BSTRC.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1521563002 . (cherry picked from commit 1956a174020686f91cd3b34294e91f4560fe45aa) Review URL: https://codereview.chromium.org/1526823002 .
2015-12-14Merge to XFA: Properly land "Fix hint table loading issues."Oliver Chang
R=thestig@chromium.org TBR=thestig@chromium.org BUG=566179 Original Review URL: https://codereview.chromium.org/1524983002 . (cherry picked from commit 1eb7477b3e7c5cb7c54ca364810ab9a24acad4f9) Review URL: https://codereview.chromium.org/1525793003 .
2015-12-14Merge to XFA: Fix hint table loading issues.Oliver Chang
BUG=566179 TBR=thestig@chromium.org Original Review URL: https://codereview.chromium.org/1523523002 . (cherry picked from commit be8408f43bcfd69a74007a340a4c034004146c60) Review URL: https://codereview.chromium.org/1518403003 .
2015-12-11Merge to XFA: Fix memory leaks involving InsertIndirectObject()Jun Fang
BUG=447331 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1514093002 . Review URL: https://codereview.chromium.org/1515403003 .
2015-12-11Merge to XFA: Fix a regression for parsing '/' - commit a568ff2d was too ↵Lei Zhang
strict. BUG=pdfium:326 TBR=dml@google.com Review URL: https://codereview.chromium.org/1521543002 . (cherry picked from commit ebc7695c60fc3e4afbfa6d9db162a71b190bf685) Review URL: https://codereview.chromium.org/1519323002 .
2015-12-09Merge to XFA: Prevent infinite looping in CPDF_Parser::LoadAllCrossRefV5().Lei Zhang
BUG=pdfium:298 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1496703005 . (cherry picked from commit 93181f9a20db7ac706bb9405750303db93762a5b) Review URL: https://codereview.chromium.org/1514783002 .
2015-12-09Merge to XFA: Get rid of most uses of CFX_PtrArray.Tom Sepez
Original Review URL: https://codereview.chromium.org/1518593002 . (cherry picked from commit 035359cd8ddb555fa33b6133db4fd405e4660712) R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1513103002 .
2015-12-06Merge to XFA: fix for stream object readingWei Li
Loosen a check for earlier version of PDF files. When the bytes with specified length are followed by 'endstream' keyword, even if there is no EOL marker before the keyword, it signals the end of stream. BUG=551258 TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1499433002 . (cherry picked from commit 0ff66089c87ab6e3adaaff0ec69728ce7a8d8299) Review URL: https://codereview.chromium.org/1504723002 .
2015-12-04Merge to XFA: Fix an incorrect check in CPDF_DataAvail::CheckHintTables.Oliver Chang
R=tsepez@chromium.org TBR=tsepez@chromium.org BUG=566179 Original Review URL: https://codereview.chromium.org/1504513002 . (cherry picked from commit 2d16308298f236ae81aa11a53f2d4e25b502dfac) Review URL: https://codereview.chromium.org/1501123002 .
2015-12-01Merge to XFA: Add basic checking for RebuildCrossRefWei Li
RebuildCrossRef function returns false when we can not find file trailer or any indirect object. This serves as a basic file format checking. BUG=pdfium:215 TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1476163002 . (cherry picked from commit f14da1d58e8e12633c7a47e6efd5ffe43bb37b4b) Review URL: https://codereview.chromium.org/1486383002 .
2015-11-20Make XFA core/ look like master (part N).Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1463173003 .
2015-11-19Merge to XFA: Cache object numbers in CPDF_Parser::ParseIndirectObject().Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1458633004 . (cherry picked from commit 0c8e6c1f39f20985a3efb17292e46c476194183a) Review URL: https://codereview.chromium.org/1461693005 .