summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2018-06-08Add constants for PDF 1.7 spec, table 3.27.Lei Zhang
BUG=pdfium:1049 Change-Id: Ie8bdb893d2af8d63420027a7ef95baf58cd97aa6 Reviewed-on: https://pdfium-review.googlesource.com/34691 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-08Move getting the CPDF_CryptoHandler into CPDF_Creator::WriteStream()Henrique Nakashima
No reason to get it outside and pass it in. Change-Id: I75e3bbd361c04e195004d7c538145dfd56294816 Reviewed-on: https://pdfium-review.googlesource.com/34731 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-08Move member initializations to cpdf_creator.hHenrique Nakashima
Change-Id: If19338b63b09ca79aa07c6fbb8eb7e42a689360e Reviewed-on: https://pdfium-review.googlesource.com/34730 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-08Instead of CPDF_Creator::m_dwFlags, store its two supported bits.Henrique Nakashima
m_IsIncremental and m_IsOriginal are extracted as soon as the flags are set, so there is no more need for getters. Change-Id: I34331a33d83c1fcbdea6ea1f3e39dfc58d6f85ea Reviewed-on: https://pdfium-review.googlesource.com/34711 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-08Remove unused methods in CPDF_Creator, mark others as private.Henrique Nakashima
Also remove the member variable m_dwEncryptObjNum which is never read. Change-Id: Ieb674d6d9783ef298ba3ece1544437b15ad0afe2 Reviewed-on: https://pdfium-review.googlesource.com/34694 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-08Remove CPDF_Creator::InitOldObjNumOffsets(). It does nothing.Henrique Nakashima
This method is called, but it returns void and has no side effects: all called methods are const, and no member or static variable is modified. Change-Id: I12084000621728b9994fe7b487852928e7b1180e Reviewed-on: https://pdfium-review.googlesource.com/34690 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-07Reland "Reland "Simplify CPDF_HintsTable.""Artem Strygin
This is a reland of d89f1bf48f017ab9f56df13299f75a906ed33cd0 Original change's description: > Reland "Simplify CPDF_HintsTable." > > This is a reland of 33591752d2cb14f2e07726ca52afce6efbdc07c9 > > Original change's description: > > Simplify CPDF_HintsTable. > > > > Use CPDF_LinearizedHeader directly. > > > > Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa > > Reviewed-on: https://pdfium-review.googlesource.com/15770 > > Reviewed-by: Lei Zhang <thestig@chromium.org> > > Commit-Queue: Lei Zhang <thestig@chromium.org> > > Change-Id: I2b5425a6533f4ce237f9ae6c483caa517105a5f7 > Reviewed-on: https://pdfium-review.googlesource.com/34130 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Art Snake <art-snake@yandex-team.ru> Change-Id: If34c4ea05db7c9abaf2ba75ebe1abaabb962dd88 Reviewed-on: https://pdfium-review.googlesource.com/34410 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-06-07Rename CPDF_PageObjectHolder::GetFormDict() to GetDict().Henrique Nakashima
Renamed the underlying member m_pFormDict as well. These names are misleading, as a page also uses the same field as the page dict. Change-Id: I52e0f1864a917a1e1b863725cb0d4f22faecacb3 Reviewed-on: https://pdfium-review.googlesource.com/34450 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-07Return from GenerateContent() if m_pObjHolder->GetFormDict() is null.Henrique Nakashima
Currently this case will lead to a crash, as pContent will be null and pPageDict will be dereferenced. This is a theoritical case, there is no concrete test case. Change-Id: Ieedab26cd9f419ab49aa2cde15f1b8e3c230b61d Reviewed-on: https://pdfium-review.googlesource.com/34430 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-07Check is first page number valid in CPDF_LinearizedHeader.Artem Strygin
Bug=chromium:850407,chromium:850440 Change-Id: I0115f75677db618b0de5e1e78b13da80b1da9559 Reviewed-on: https://pdfium-review.googlesource.com/34390 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-07Revert "Reland "Simplify CPDF_HintsTable.""Ryan Harrison
This reverts commit d89f1bf48f017ab9f56df13299f75a906ed33cd0. Reason for revert: This CL has introduced at least two CF issues chromium:850407,chromium:850440. Additionally there is a number of changes that remove bounds checks, which I think are suspect. BUG=chromium:850407,chromium:850440 Original change's description: > Reland "Simplify CPDF_HintsTable." > > This is a reland of 33591752d2cb14f2e07726ca52afce6efbdc07c9 > > Original change's description: > > Simplify CPDF_HintsTable. > > > > Use CPDF_LinearizedHeader directly. > > > > Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa > > Reviewed-on: https://pdfium-review.googlesource.com/15770 > > Reviewed-by: Lei Zhang <thestig@chromium.org> > > Commit-Queue: Lei Zhang <thestig@chromium.org> > > Change-Id: I2b5425a6533f4ce237f9ae6c483caa517105a5f7 > Reviewed-on: https://pdfium-review.googlesource.com/34130 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Art Snake <art-snake@yandex-team.ru> TBR=thestig@chromium.org,tsepez@chromium.org,art-snake@yandex-team.ru Change-Id: I463b5b1330f809c2cb508cbf46a804b7a11526e4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/34350 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-06Reland "Simplify CPDF_HintsTable."Artem Strygin
This is a reland of 33591752d2cb14f2e07726ca52afce6efbdc07c9 Original change's description: > Simplify CPDF_HintsTable. > > Use CPDF_LinearizedHeader directly. > > Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa > Reviewed-on: https://pdfium-review.googlesource.com/15770 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> Change-Id: I2b5425a6533f4ce237f9ae6c483caa517105a5f7 Reviewed-on: https://pdfium-review.googlesource.com/34130 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-06-06Simplify check root availability.Artem Strygin
Change-Id: I34403490672b752bed9d5b6b29e8f4422c0fbf95 Reviewed-on: https://pdfium-review.googlesource.com/17732 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-06Simplify check info availability.Artem Strygin
Change-Id: I4475b83f69426b135c304d5861f0b7bb582deb81 Reviewed-on: https://pdfium-review.googlesource.com/17731 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-06-06Use CPDF_StreamAcc to data access of CPDF_Stream.Artem Strygin
Change-Id: I68b88e013ac542f245dbe7b6889799c814d46eb8 Reviewed-on: https://pdfium-review.googlesource.com/33690 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-06-05Revert "Do not merge content streams to parse them."Henrique Nakashima
This reverts commit 9d3fb11a985a8f2aefbf361c0030c7bce2248b8e. Reason for revert: Break rendering of http://www.flbb.lu/bio_files/BIO_25_2005.pdf Original change's description: > Do not merge content streams to parse them. > > Removed the PrepareContent() step in CPDF_ContentParser, as its goal > was to merge these streams. > > In Parse(), now loop through the m_StreamArray and parse each stream > separately. > > Bug: pdfium:1051 > Change-Id: Id07f3efe766828081c8cf8601bf69c4f37e20e13 > Reviewed-on: https://pdfium-review.googlesource.com/33595 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I8186b2dac8538ca477302bb91e22dcc54124461a Bug: pdfium:1051 Reviewed-on: https://pdfium-review.googlesource.com/33991 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-05Tidy parser lifecycle state machine in CPDF_PageObjectHolder.Tom Sepez
Only update state in CPDF_PageObjectHolder itself. Make more data private. Remove CPDF_Page::GetPageBBox() as exact duplicate of CPDF_PageObjectHolder::GetBBox(). Change-Id: I083ec33f61a1490e7a5e673c9787751af15a6cd1 Reviewed-on: https://pdfium-review.googlesource.com/33810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-05Revert "Create m_ContentStream field in CPDF_PageObject."Henrique Nakashima
This reverts commit d3d8287e143daf12a602a919c120b4e0c656abf8. Reason for revert: Need to revert https://pdfium-review.googlesource.com/c/pdfium/+/33595 that this depends on. Original change's description: > Create m_ContentStream field in CPDF_PageObject. > > Content streams are now split and can set nonzero values to identify > each parsed content stream. > > Bug: pdfium:1051 > Change-Id: Ia2cb1e0997db5264d468043af31f9b41e8d0d349 > Reviewed-on: https://pdfium-review.googlesource.com/33591 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I5046b6a76508fccc0ff04cb7393cae6485dd091f No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: pdfium:1051 Reviewed-on: https://pdfium-review.googlesource.com/33990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-05Assert CPDF_ContentParser always has a valid page holder.Lei Zhang
Change-Id: Ia9b3066c8076ed296125bf514c07f7118c52dd05 Reviewed-on: https://pdfium-review.googlesource.com/33850 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-05Move CPDF_PageObjectHolder::m_pFormStream to CPDF_Form.Lei Zhang
This member variable is only used in the CPDF_Form subclass. Change-Id: Ib922228e51f5c3b370027e565d04ffe47374a320 Reviewed-on: https://pdfium-review.googlesource.com/33830 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-05Create m_ContentStream field in CPDF_PageObject.Henrique Nakashima
Content streams are now split and can set nonzero values to identify each parsed content stream. Bug: pdfium:1051 Change-Id: Ia2cb1e0997db5264d468043af31f9b41e8d0d349 Reviewed-on: https://pdfium-review.googlesource.com/33591 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-05Revert "Convert (void) to static_cast<void> in C++ code"Ryan Harrison
This reverts commit 80c6ab7b99bcbd7b940f78dc0cac52c30249f59c. Reason for revert: (void) idiom is prevalent through out C++ code. Original change's description: > Convert (void) to static_cast<void> in C++ code > > Converting instances of old C-style void casts to suppress return > values to use C++ style static cases. There are a few examples of > (void) that remain, since they are in C code, and the third_party/ > instances are not touched at all. > > Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe > Reviewed-on: https://pdfium-review.googlesource.com/33790 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: Ib6cc021c97cb1ea7c71b90346fa9b500659f565d No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/33890 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-05Add test for FPDF_GetPageSizeByIndex()Tom Sepez
Ensure that FPDF_GetPageSizeByIndex() doesn't do a full page parse. Issue was noticed on CL https://pdfium-review.googlesource.com/32830 Change-Id: I51966e0b91e1a002d33ee51f00c0428fa1cda04d Reviewed-on: https://pdfium-review.googlesource.com/33792 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-05Share read validator between CPDF_DataAvail and CPDF_SyntaxParser.Artem Strygin
Change-Id: I61c92050b034fbffa747a2519aba368e9678afcd Reviewed-on: https://pdfium-review.googlesource.com/15850 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-05Remove useless code.Artem Strygin
Change-Id: I68bd9004cb034df749625f4c83072b08d33202e4 Reviewed-on: https://pdfium-review.googlesource.com/17730 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-04Convert (void) to static_cast<void> in C++ codechromium/3450Ryan Harrison
Converting instances of old C-style void casts to suppress return values to use C++ style static cases. There are a few examples of (void) that remain, since they are in C code, and the third_party/ instances are not touched at all. Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe Reviewed-on: https://pdfium-review.googlesource.com/33790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-04Do not merge content streams to parse them.Henrique Nakashima
Removed the PrepareContent() step in CPDF_ContentParser, as its goal was to merge these streams. In Parse(), now loop through the m_StreamArray and parse each stream separately. Bug: pdfium:1051 Change-Id: Id07f3efe766828081c8cf8601bf69c4f37e20e13 Reviewed-on: https://pdfium-review.googlesource.com/33595 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-04Clean up of comment from post-submitRyan Harrison
Landed https://pdfium-review.googlesource.com/c/pdfium/+/33592 without addressing some comments that appeared after I sent it to CQ, this addresses them. Change-Id: Ic9c4d81328aafee6ff8431460c5b8b674e25ad38 Reviewed-on: https://pdfium-review.googlesource.com/33712 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-04Revert "Make CPDF_Document cache CPDF_Pages"Tom Sepez
This reverts commit f0d9d28a034fe3650c3c2d662090c1e8687ddb16. Reason for revert: avoid parsing page. Change-Id: Id3478f7e38f1cbe95d098e00158b1d7d9dc6f76e Reviewed-on: https://pdfium-review.googlesource.com/33750 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-04Revert "Make common page base class for XFA and non-XFA."Tom Sepez
This reverts commit d06cc38b76685b002c51b227ae43b8314d926ad8. Reason for revert: blocking previous revert Change-Id: I74f8b80852c671440cca5fabef30e69cde9e2063 Reviewed-on: https://pdfium-review.googlesource.com/33713 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-01Remove unused assignments in test codeRyan Harrison
prev_offset is written multiple times through out CPDF_CrossRefAvailTest, but not read until it is written again. Removing this unused intermediate writes. Issues found with Clang Static Analyzer. Change-Id: I980263b8be7f691c030e937a05f248fd9b133fb4 Reviewed-on: https://pdfium-review.googlesource.com/33592 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-31Make CPDF_Document own its Extension.Tom Sepez
Inverting the ownership from the current situation makes cleanup much more intuitive. Change-Id: Iad9a7ca70c0746170ba753297732e3e34f96c5ba Reviewed-on: https://pdfium-review.googlesource.com/33190 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
2018-05-31Clean up some nits in CPDF_Type3GlyphNicolas Pena
Change-Id: Ia466bb0119d914794b0d7ed9385547a7be245858 Reviewed-on: https://pdfium-review.googlesource.com/33312 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-31Handle image mask continuous loading correctlyWei Li
When image mask doesn't need multi-steps to load, ContinueLoadMaskDIB() will return LoadState::kFail as result. For this case, the loading should continue as usual instead of aborting. BUG=pdfium:1087 Change-Id: I5c43a67e43469ac7febca4c0cf1faa96ee105206 Reviewed-on: https://pdfium-review.googlesource.com/33310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Wei Li <weili@chromium.org>
2018-05-31Move codepage/charset methods into related places.Artem Strygin
Change-Id: I71417cc5b1bd00f77d42740198cc17487ebd686e Reviewed-on: https://pdfium-review.googlesource.com/33330 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-05-30Remove dead code in various write function.Lei Zhang
BUG=pdfium:1093 Change-Id: I05f32018841dfa8b1c4512fb6350fc2a2fe4c5e4 Reviewed-on: https://pdfium-review.googlesource.com/33250 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-30Exclude certain colorspace types for calculating transparency backdrop color.Lei Zhang
Per discussion for the "CS" entry in the PDF 1.7 spec table 7.13, several types of colorspaces do not meet the requirements of this particular colorspace entry. In terms of implementation, this avoids hitting a NOTREACHED() in CPDF_PatternCS::GetRGB(). BUG=chromium:847346 Change-Id: If994a91cdcd84b8977196256ee6926e20c4b74aa Reviewed-on: https://pdfium-review.googlesource.com/33210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-30Make common page base class for XFA and non-XFA.Tom Sepez
Now that both are ref-counted, we can replace ifdef's with some polymorphism. Bug: pdfium:760 Change-Id: Ie22ea259c9af56fa569f0af268b8e7065789a3f2 Reviewed-on: https://pdfium-review.googlesource.com/32892 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-30Make CPDF_Document cache CPDF_PagesTom Sepez
We cache pages not by page number, which can bounce around as pages are inserted or removed, but by page dictionary's object number. Since the page may be created under one function and used under another, we can't take the shortcut of not instantiating a render cache nor not parsing the page. Change-Id: I9a325cda8b3141153544ac53e78a51a44e6b411a Reviewed-on: https://pdfium-review.googlesource.com/32830 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-29Get rid of FXARGB_MAKE macro.Lei Zhang
ArgbEncode() does the same thing. Change-Id: Ibb05ed4aae720c0a5ba66771699c0d7e11230921 Reviewed-on: https://pdfium-review.googlesource.com/32230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-28Revert 'Remove almost all usages of CFX_FixedBufGrow with std::vector'chromium/3444Nicolas Pena
This is a manual revert of the CL at: https://pdfium-review.googlesource.com/c/pdfium/+/32159 The only file manually changed was cpdf_renderstatus.cpp Reason for revert: the bug below shows that sometimes the vector size used is larger than the parameter given to CFX_FixedBufGrow. Thus, we will revert, then add vectors using std::max unless it's clear from the code that the code will never access indices outside. Bug: chromium:847247 Change-Id: Iee54af023c8564824418a7d34a6385b0bc418ff0 Reviewed-on: https://pdfium-review.googlesource.com/33050 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-28Add const/non-const versions of remaining CPDF_Dictionary methods.Lei Zhang
GetObjectFor() and GetDirectObjectFor(). Change-Id: I588cd994dfccf0ffd4c8f91362a4806dc109251e Reviewed-on: https://pdfium-review.googlesource.com/32991 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-25Replace some #ifdef PDF_ENABLE_XFA with runtime checks.Tom Sepez
Abstract GetUserPermissions() differences via new virtual method. Abstract GetPageCount() differences via existing virtual method. Remove unused ReadHeader() form for non-xfa. Remove unused FindSubstFontByUnicode() for xfa. Remove unused FXFONT_EXACTMATCH Change-Id: I0a3de01a9841db86fcbc96991d3fa2682393b9ad Reviewed-on: https://pdfium-review.googlesource.com/32831 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-25Make CPDF_Page retainable.Tom Sepez
Small step to reducing the differences between XFA and non-XFA. We still use the RetainPtr pretty much as if it were an unique_ptr, in that we're not yet caching pages and handing out multiple pointers to the same page in the non-XFA case. The one change is in page view cleanup, where we no longer need a boolean and can take (sufficient) page ownership with a RetainPtr. Tidy up some document.h -> page.h -> document.h circular inclusion while we're at it. NOTE: Wait for imminent branch to pass before landing. We'll want this to bake a while. Change-Id: I64a2f12ac3424ece1063d40583995b834117cf34 Reviewed-on: https://pdfium-review.googlesource.com/32790 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-25Add proper const/non-const versions of CPDF_Dictionary::GetDictFor().Lei Zhang
BUG=pdfium:234 Change-Id: I6fde00c976ad4bb9cab632f465cf292f5b1da3d2 Reviewed-on: https://pdfium-review.googlesource.com/32914 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-25Add proper const/non-const versions of CPDF_Dictionary::GetArrayFor().Lei Zhang
BUG=pdfium:234 Change-Id: I5c900aa0547afef0c60de35422b4ee489daa6cfb Reviewed-on: https://pdfium-review.googlesource.com/32913 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-25Mark more CPDF_Objects as const in font code.Lei Zhang
Change-Id: Id37333ba61ad0d395055acffd75d4d8be5eb2b3e Reviewed-on: https://pdfium-review.googlesource.com/32911 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-25Add proper const/non-const versions of CPDF_Dictionary::GetStreamFor().chromium/3441Lei Zhang
BUG=pdfium:234 Change-Id: Ia3e758bbe5c445c3856f5215e900e02a16b4d7d7 Reviewed-on: https://pdfium-review.googlesource.com/32910 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-25Mark CPDF_Object pointers in pattern code as const.Lei Zhang
Change-Id: Id7bf252ebe25c92d26065d1138a445ebb2f78d0b Reviewed-on: https://pdfium-review.googlesource.com/32187 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-24CPDF_HintTables should not try to read 0 bits.Lei Zhang
CFX_BitStream::GetBits() got refactored recently, with an assert to not read 0 bits. A fuzzer then discovered code that is trying to do that. BUG=chromium:846394 Change-Id: Ib18b47200c82aab369109b5911540db724172690 Reviewed-on: https://pdfium-review.googlesource.com/32934 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>