summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-05-02Remove int out params from reference to pointer in CXFA_Node.Henrique Nakashima
Return a CFX_Size instead. Change-Id: I3bef1093fbc887237aa69dc942f878af27b4e8e9 Reviewed-on: https://pdfium-review.googlesource.com/31911 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-02Make several Huffman decoders consistently check for integer overflows.Lei Zhang
BUG=chromium:837972 Change-Id: I6cfa28bff38870419e4b1e2bced427cfcbf843cd Reviewed-on: https://pdfium-review.googlesource.com/31912 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Remove unused cpdfxfa_context.h includes from unittestsTom Sepez
A previous CL removed the need to these inclusions. Change-Id: Idedbb1905317e90a94935884d12dbec8245e1122 Reviewed-on: https://pdfium-review.googlesource.com/31913 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-02Add CPDF_Document::Extension::GetPageCount()Tom Sepez
Another virtual API at the CPDF layer, to avoid a compile time ifdef XFA. Change-Id: Ia95c4d3b3d3b773aaf45c49ebcadff6b16ca18c6 Reviewed-on: https://pdfium-review.googlesource.com/31910 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-01Transform float out params from reference to pointer in CXFA_Node.Henrique Nakashima
Change-Id: I4039917c5342f6a4c6568029a293066901bb5db4 Reviewed-on: https://pdfium-review.googlesource.com/31870 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-01Add CPDF_Document::Extension::DeletePage()Tom Sepez
Replaces one compile-time #ifdef XFA with a dynamic check and a call through a virtual API that prevents the CPDF code from knowing anything about the XFA code. Change-Id: If0ff9b6918b908b3eac824fe1d525c6d4f7316e7 Reviewed-on: https://pdfium-review.googlesource.com/31890 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-01Avoid perpetual spins for parserless CPDF_PagesTom Sepez
This is an obstacle to introducing dummy CPDF_Pages to underly all CPDFXFA_Pages, since we would then have a parserless CPDF_Page, whose parse could never succeed or fail. The m_ParseState would never change, and if the caller dutifully recalls us until that changes, we hang. Small separate CL since it might impact non-XFA cases unexpectedly. Change-Id: I002064e5d4caa44935f50bde0f3b00e3b8cb0bfe Reviewed-on: https://pdfium-review.googlesource.com/31850 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-01Transform size out param from reference to pointer in CXFA_Node.Henrique Nakashima
Change-Id: I3ed6cbadeb9da756b30634b48ffdd1026a70b8a0 Reviewed-on: https://pdfium-review.googlesource.com/31853 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-01Transform rect out param from reference to pointer in XFA code.Henrique Nakashima
Change-Id: Ib5f8b8754bca8198d9122700d7d876b45d1428da Reviewed-on: https://pdfium-review.googlesource.com/31852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Start at today's date in XFA Month Calendar.chromium/3417Henrique Nakashima
Bug: pdfium:751 Change-Id: I125fbb0dd8ff4a382c4cec33a29c52a97e67de23 Reviewed-on: https://pdfium-review.googlesource.com/31851 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Clean up CFX_BidiString.Lei Zhang
- Refer to the string in CFX_BidiString by const-ref. - Remove useless CharAt() method. - Turn a member variable into a local variable. Change-Id: I30f221b7350150c839a793129789d8ea7cc1f331 Reviewed-on: https://pdfium-review.googlesource.com/31670 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-01Fix last character missing from strings in XFA Month Calendar.Henrique Nakashima
This was a bug introduced in a refactor a long, long time ago. A line was removed (probably unintentionally). https://chromiumcodereview.appspot.com/2435603003/diff/40001/xfa/fxfa/app/xfa_fwltheme.cpp Bug: pdfium:751 Change-Id: I0e3d094a543bd0e31010a8093387906d62c0a5dc Reviewed-on: https://pdfium-review.googlesource.com/31830 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Check for NULL XFA context even when XFATom Sepez
Use strict typing for FPDF_Page to ensure we don't fall into code that expects the other page type when continuing from null context case. Change-Id: I7f028ef3e3d733f5557620030a87e22997da00d5 Reviewed-on: https://pdfium-review.googlesource.com/31770 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-01Make FPDF_Document always be CPDF_Document.Tom Sepez
Greatly minimize the impact between going back and forth from XFA being on/off, so that XFA case is just an extension beyond the non-XFA data structures we've shipped for years, instead of being a complete replacement of them. Change-Id: I6c98206e0ec99ea443547a4931eba912b1764d54 Reviewed-on: https://pdfium-review.googlesource.com/31690 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-01Introduce the concept of CPDF_Page::ExtensionTom Sepez
Similar tp CPDF_Document::Extension, this is a base type for fpdfsdk/ to use to improve layering. While we're at it, make pages point to documents to prove they don't outlive them. Another small step towards not passing XFA objects across FPDF. Change-Id: Idcee9da3a18c06331fa56f3d6c188e4ce27d34f2 Reviewed-on: https://pdfium-review.googlesource.com/31631 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-01Fixes XML Instruction handling in CXFA_DocumentParser.Dan Sinclair
This CL fixes issues with handling XML instructions in CXFA_DocumentParser. Unittests were added to verify the behaviour. Change-Id: Iff8d51d0e6d411419473c9b2c32c700d4bbf86f5 Reviewed-on: https://pdfium-review.googlesource.com/31810 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Fix CFX_XML and add unit testsDan Sinclair
This CL fixes several issues in the CFX_XML class and adds unit tests. Change-Id: I05270690de8f3c45dceb866e17ef899ae6d23389 Reviewed-on: https://pdfium-review.googlesource.com/31753 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-01Fix possible integer overflows in CFX_RTFBreak.Henrique Nakashima
Bug: chromium:838095 Change-Id: I21de7cf88c995446049faa3d688a286faa117868 Reviewed-on: https://pdfium-review.googlesource.com/31754 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-01Add struct CJBig2_GRDProc::ProgressiveArithDecodeState.Lei Zhang
Track the decode state in one data structure. Also grab pointers to data structure members before tight loops when decoding. It turns out referring to this->foo in tight loops can actually slow down decoding. Change-Id: I6a09b08ca06ef05968966055b5ad20f8c89896af Reviewed-on: https://pdfium-review.googlesource.com/31790 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-01Clean up CJBig2_Image compose methods.Lei Zhang
- Mark them private when possible. - Disambiguate method names. - Make method names match the style guide. - Pass in rects by reference. Change-Id: I0bf848756e81a92d20e46a81cd6260b660eaf482 Reviewed-on: https://pdfium-review.googlesource.com/31772 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-30Reorganize Unicode_GetNormalization() some more.Lei Zhang
Change-Id: I183a53d08f5da73d788c92b53382e3fac3b823e2 Reviewed-on: https://pdfium-review.googlesource.com/31671 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-30Add CPDF_TextPage::GetPrevCharInfo() helper method.Lei Zhang
Change-Id: Ie5bea82757682390b274ad2da77d1686cc597046 Reviewed-on: https://pdfium-review.googlesource.com/31657 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-30Change out parameter of CFGAS_GEFont::GetCharWidth to pointer.chromium/3416Henrique Nakashima
Change-Id: I1e04c7645b2238d292a6a8eb5fb5fa365fa958f5 Reviewed-on: https://pdfium-review.googlesource.com/31752 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-30Fix more possible integer overflows in CFX_TxtBreak.Henrique Nakashima
Bug: chromium:838095 Change-Id: I9b5edefbff9f84b9b913ab4387a7df2588e203fb Reviewed-on: https://pdfium-review.googlesource.com/31751 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-30Simplify Unicode_GetNormalization() and caller.Lei Zhang
Change-Id: I9a5acb59790fd8527ced745370bdfe35e4d21c36 Reviewed-on: https://pdfium-review.googlesource.com/31656 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-30Fix some nits in CPDF_TextPage.Lei Zhang
Change-Id: Ib0b1d014af31493c73a74d81c1f3454a203da949 Reviewed-on: https://pdfium-review.googlesource.com/31655 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-30Saner memory managment in cttfontdesc, part 1.Tom Sepez
A subsequent patch will tackle the ad-hoc ref counting, but we can tidy this before going down that hole. Decouple CTTFontDesc creation from face setting. Remove union and treat single-entry case as vector's first element. Pass unique_ptr to prove memory ownership. Change-Id: Ic427798da04f3afbb65a56ee10045b9f22457a73 Reviewed-on: https://pdfium-review.googlesource.com/31730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-30Fix Integer-overflow in CFX_TxtBreak::AppendChar_OthersHenrique Nakashima
Bug: chromium:838095 Change-Id: I6fbb67ad763800eb45fb3c84f909f74e238748e0 Reviewed-on: https://pdfium-review.googlesource.com/31750 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-30Optimize yet another piece of barcode codeRyan Harrison
Rolling two iterations over the input into one, and reserving the maximum possibly output size to avoid memory thrash when appending. Under Valgrind this reduces the instruction count by ~200x BUG=chromium:837610 Change-Id: If12a3b98048b41906a4401d4dcc9470b513e28d2 Reviewed-on: https://pdfium-review.googlesource.com/31731 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-30Make CPDFSDK_FormFillEnvironment always hold a CPDF_Document.Tom Sepez
Small step towards removing UnderlyingDocumentType and making FPDF documents always be CPDF documents, regardless of XFA. This improves layering a bit in the process. Change-Id: Ice5ed7ba1ffdd7edfc9c4719f0e3a9cfb22f5790 Reviewed-on: https://pdfium-review.googlesource.com/31672 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Tidy cfx_gif.h.chromium/3415chromium/3414chromium/3413Tom Sepez
Use C++ style struct syntax (file already has other C++ features). Assert that things have packed as intended since they map to known layouts. Order these asserts in the same order as .h file. Change-Id: I0a006c4b5789fb544783f488d5b4e609e32c7ec1 Reviewed-on: https://pdfium-review.googlesource.com/31654 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Remove an obsolete TODO.Lei Zhang
Should have been removed in commit 704a617e. TBR=hnakashima@chromium.org Change-Id: I3871cb5ca0fa02247530af1fab86e2c321d467ad Reviewed-on: https://pdfium-review.googlesource.com/31653 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-27Fix illegal cast in core/fxge/win32/fx_win32_gdipext.cppTom Sepez
Bug: pdfium:243 Change-Id: I36ebe64daa042b998878ffacfca9846b5303450b Reviewed-on: https://pdfium-review.googlesource.com/31652 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Remove CJBig2_HuffmanTable::InitCodes().Lei Zhang
Use CJBig2_Context::HuffmanAssignCode() instead. Change-Id: Ief187420494a8cefa26eeedb98a55683caf7807b Reviewed-on: https://pdfium-review.googlesource.com/31538 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Replace void* with CFX_GifPalette* in fxcodecTom Sepez
The type is known where we need it, and we avoid some dubious casts in the process. Also avoid clumsy indexing and use the members directly in computations. Bug: pdfium:243 Change-Id: I1e061465fd0f9045cf5b82067204f26ac7df53f0 Reviewed-on: https://pdfium-review.googlesource.com/31651 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Fix focused day disappears in XFA MonthCalendar.Henrique Nakashima
Bug: pdfium:751 Change-Id: I27c4cf96c1b0d314ace8461ca6020c1034eff646 Reviewed-on: https://pdfium-review.googlesource.com/31650 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Update caret after changes that could move lines in XFA edit.Henrique Nakashima
This fixes issues when a line break is deleted and the caret remains where it was, now between two lines. Bug: chromium:836361 Change-Id: I6cd40402a97348bcfc4c9291e7acb044a1e68113 Reviewed-on: https://pdfium-review.googlesource.com/31391 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Change CJBig2_HuffmanTable to use struct JBig2HuffmanCode.Lei Zhang
Change-Id: I6461f81a3d8005efa75b8141c18c502a63252883 Reviewed-on: https://pdfium-review.googlesource.com/31537 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Adjust CJBig2_Context::HuffmanAssignCode().Lei Zhang
It looks a lot like CJBig2_HuffmanTable::InitCodes(). Port over the UBSAN error fix from commit 76c9a1b1. BUG=chromium:709781 Change-Id: I5d2f8fb013c09099c82b0565627b77e4fb0f8a98 Reviewed-on: https://pdfium-review.googlesource.com/31536 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Remove arguments from CPDFSDK_FormFillEnvironment methods (part 2)Tom Sepez
Follow-on from https://pdfium-review.googlesource.com/c/pdfium/+/31591 Under XFA, the Form Fill Environment already has the XFA context, so there is no need for callers to obtain it and pass it. Tidy some duplicate string allocations along the way. Change-Id: Ia7614b200146e7ca1f68a18f9d2ce118946b53e8 Reviewed-on: https://pdfium-review.googlesource.com/31610 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Simplify CJBig2_Context::DecodeSymbolIDHuffmanTable().Lei Zhang
One of its parameters is a member variable. Change-Id: I0dcb78275d9ea5b05a77e211d178a0efb8699395 Reviewed-on: https://pdfium-review.googlesource.com/31535 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Use std::function in CJBig2_GRDProc.Lei Zhang
Pick from a set of functions before calling it, instead of having code to call all of the functions with the same parameters. Change-Id: I7f479948f50bdc1a9eb2764d5eb7505dc7434418 Reviewed-on: https://pdfium-review.googlesource.com/31533 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Fix backspace on 1st character of a line erases the line break.Henrique Nakashima
Bug: chromium:836361 Change-Id: I39a0a3f9cb59ceb81f944dd5d0d4fd38a2e18a6b Reviewed-on: https://pdfium-review.googlesource.com/31411 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Disambiguate methods in CJBig2_GRDProc.Lei Zhang
Also remove method parameters that always refer to the same member variables. Change-Id: I9751d63895cc59e5280283795e39b50fd42eef94 Reviewed-on: https://pdfium-review.googlesource.com/31532 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-27Simplify CJBig2_Context::FindReferredSegmentByTypeAndIndex().Lei Zhang
It only looks for a single segment type. Change-Id: I83457c6f74c210299caec79a563e7876f4d1d9ea Reviewed-on: https://pdfium-review.googlesource.com/31534 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Avoid potential duplicate unique_ptr to CPDF_Document from CPDFXA_Context.Tom Sepez
Should FPDFDocumentFromCPDFDocument() be called several times under XFA, we may WrapUnique() the document several times. So cache a pointer back from CPDF_Document to CPDFXFA_Context to avoid this. Because of layering, introduce a placeholder type CPDF_Document::Extension. This is actually the first step in some larger XFA ownership cleanup, but makes a nice standalone CL around the one particular issue. Change-Id: I4be326ddb1a5fae7339e6ed6745dd551b1374b53 Reviewed-on: https://pdfium-review.googlesource.com/31570 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Remove argument from CPDFSDK_FormFillEnvironment::GetCurrentPageTom Sepez
Small tidying. The form fill environment is 1:1 with documents, and already knows its underlying document. The callers all first obtain this from the FFE and then pass it back into it. Change-Id: I33835c1dc847ca67f2cc633c87af2f6e003ef58a Reviewed-on: https://pdfium-review.googlesource.com/31591 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-27Add DEPS include_rules for xfa/fwl.Lei Zhang
BUG=pdfium:507 Change-Id: I28eeb9a5f6d7099eef6d8e7e37d425cd4613c49c Reviewed-on: https://pdfium-review.googlesource.com/31430 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-27Fix undefined behavior in AGG.Lei Zhang
BUG=chromium:746232 Change-Id: Id8f22d09bc7768603ea67bd52a5a5b3d87885ea9 Reviewed-on: https://pdfium-review.googlesource.com/31370 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-27Do validation earlier in CPDF_SampledFunc::v_Init(). (try 2)Lei Zhang
This time, correctly multiply |nTotalSampleBits| before checking it. Change-Id: I68befeedb54626314f7bb00a35e567d2cbf1cc10 Reviewed-on: https://pdfium-review.googlesource.com/31152 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>