summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-04-17Convert CFX_XMLParser to take a IFX_SeekableStreamdan sinclair
This CL changes the CFX_XMLParser to accept an IFX_SeekableStream intead of a CFX_SeekableStreamProxy. Change-Id: I3534288a8a00095acd78a60bf6b925c6a0357892 Reviewed-on: https://pdfium-review.googlesource.com/30856 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-17Remove unused CFX_SeekableStreamProxy From CFGAS_GEFontdan sinclair
The CFGAS_GEFont::LoadFontInternal which takesa a CFX_SeekableStreamProxy was never implemented. The stream member is never used. Change-Id: Ia9c5434c55f6ff2f709bb3ad49ecd9ee3fd3b122 Reviewed-on: https://pdfium-review.googlesource.com/30855 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-17Cleanup some seekablestreamproxy codedan sinclair
This CL fixes up some cfx_seekablestreamproxy includes and adds a helper to the xmlparser tests. Change-Id: If1b67dee51b49fa39527274f6c68da5ec673704f Reviewed-on: https://pdfium-review.googlesource.com/30854 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-17Remove write abilities from CFX_SeekableStreamProxydan sinclair
This CL removes the abliity to write to the seekable stream proxy class. Change-Id: I0eda2619714df190d326c23dfdcd4527d4312779 Reviewed-on: https://pdfium-review.googlesource.com/30853 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-17Use IFX_SeekableStream in xfa_utilsdan sinclair
This CL converts xfa_utils to use an IFX_SeekableStream instead of a CFX_SeekableStreamProxy. Change-Id: I824b477351ac29d54118df2f3c5442c503aa3671 Reviewed-on: https://pdfium-review.googlesource.com/30852 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-17Use an IFX_SeekableStream for XML savingdan sinclair
This CL converts the CFX_XML Save methods to take an IFX_SeekableStream instead of a CFX_SeekableStreamProxy. Change-Id: I6b3f6acc9f51e73b3c863b965b4dcdcbd25ba949 Reviewed-on: https://pdfium-review.googlesource.com/30850 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-17Use span in CXFA_LocaleValue::GetDoubleNum()chromium/3399Tom Sepez
Get runtime checks instead of just asserts. Use early return while at it to save some indentation. Fix one out-of-bounds case noted by inspection. Add tests, and fix bugs that gave the wrong answers. This should be removed at our earliest convenience. Its likely to still be wrong. Change-Id: I2a68edc854c8b28c434fe28397b7834e5c9c3670 Reviewed-on: https://pdfium-review.googlesource.com/30530 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-17Re-land "Return pdfium::span<char> from ByteString::GetBuffer().""Tom Sepez
This reverts commit 3d523e3cf89440e2ffc6571b1c687ad5e3f0318f. Fixes bounding errors now caught by tests. Change-Id: I4d0f1791bdcc45a10615a62abf7a4d20e7e538f2 Reviewed-on: https://pdfium-review.googlesource.com/30799 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-17Add constants for PDF 1.7 spec, table 3.4.Lei Zhang
Add constants/stream_dict_common.h. The header lists all the constants in the table in the same order. Constants that are not used at all are commented out. BUG=pdfium:1049 Change-Id: I6539090e0ad56319ea628883e388aeacef044e52 Reviewed-on: https://pdfium-review.googlesource.com/29090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-17Reland "Return pdfium::span<wchar_t> from WideString::GetBuffer().""Tom Sepez
This reverts commit 0d32b8fda53e02c1036d39f7290d4f59f2b58ca4. Restore behaviour on trunk. TBR: dsinclair@chromium.org Change-Id: Ia867f09ae9d2885595c4d9b300a058431dfd84f2 Reviewed-on: https://pdfium-review.googlesource.com/30811 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-17Fix nits in CPDF_Function and derived classes.Lei Zhang
- Switch away from FX_Alloc2D() when it is safe to do so. - Use FX_SAFE_SIZE_T to avoid a potential underflow with FX_Realloc(). - Mark the v_Call() input as const. - Check Call() and v_Call() return results. Change-Id: I6ec3122b23e0f137f88aa8d85a9675154a1b1706 Reviewed-on: https://pdfium-review.googlesource.com/30802 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-17Implement FORM_GetFocusedText() API.Lei Zhang
If there is a focused form field, get its text. BUG=chromium:753216 Change-Id: I05294f14d05c1c86769055f6c9eaf9177787d9fd Reviewed-on: https://pdfium-review.googlesource.com/12072 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-17Add a virtual CPWL_Wnd::GetText() method.Lei Zhang
Most CPWL_Wnd subclasses already have GetText() implementations. Change-Id: I61858019c59f915df422afaca97b8abde345575b Reviewed-on: https://pdfium-review.googlesource.com/30860 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-16Remove non-const CPDF_PageObjectHolder::GetPageObjectList().Henrique Nakashima
This makes it easier to control modifications to the page object list. Bug: pdfium:1051 Change-Id: Ia85c597fa6d39e89041b990b4b6c91e327ef811d Reviewed-on: https://pdfium-review.googlesource.com/30803 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-16Merge CFX_XMLElement and CFX_XMLAttributeNodedan sinclair
CFX_XMLElement is the only subclass of CFX_XMLAttributeNode. This CL merges the two classes together. The {Set|Get}String method has been renamed to {Set|Get}Attribute to make it clearer what you're retrieving. Change-Id: I158c961d4d8c5f563d937a3e7a35321a33622562 Reviewed-on: https://pdfium-review.googlesource.com/30710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Write out StringViewTemplate::Operator=().Tom Sepez
Avoids some weirdness in mac toolchain with external templates and Operator() = default; instantiation. Change-Id: Ieec5dc08ad559752278a6f1de8fc69aad2b4e30c Reviewed-on: https://pdfium-review.googlesource.com/30810 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Revert "Return pdfium::span<wchar_t> from WideString::GetBuffer()."Tom Sepez
This reverts commit 154e18f9a862975abecebe77b8f5fb418418d14c. Reason for revert: Generate CL to merge to beta branch Original change's description: > Return pdfium::span<wchar_t> from WideString::GetBuffer(). > > Adds bounds checking "for free", but beware of span outliving > a ReleaseBuffer() call. Scoping as such avoids the possibility > of using an invalid span (and it is flagged as a lifetime issue). > > Change-Id: Ica63f4b1429823d0254ec6951aeaeb08160cb93c > Reviewed-on: https://pdfium-review.googlesource.com/30310 > Reviewed-by: dsinclair <dsinclair@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=tsepez@chromium.org,dsinclair@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Ie1ec9434215584a024538ca8edeb59dea555af48 Reviewed-on: https://pdfium-review.googlesource.com/30830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Split GetNumbericSymbol into individual methodsdan sinclair
This CL removes the GetNumbericSymbol method and adds individual methods for each symbol we retrieve. Change-Id: Id14108e5ea43a76250e18a1aa13bdbb05e928cdc Reviewed-on: https://pdfium-review.googlesource.com/30695 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Add test for saving after adding or removing page objects.Henrique Nakashima
pdfium:1051 reported an issue with saving after calling FPDFPage_RemoveObject. This test reproduces the issue. It is left disabled since it's failing. Bug: pdfium:1051 Change-Id: I238a95e8ea7cf5f0cee7f06419f5468f3208c939 Reviewed-on: https://pdfium-review.googlesource.com/30800 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Fix some checks for FX_Realloc() failures.Lei Zhang
FX_Realloc() never fails. So either remove the check or switch to FX_TryRealloc(). Change-Id: I11fd02508add50db900a7502835018c2b61bcd09 Reviewed-on: https://pdfium-review.googlesource.com/30712 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-16Simplify CFX_DIBitmap::TransferBitmapNicolas Pena
This CL changes CFX_DIBitmap::TransferBitmap so that the exception cases are handled before, and early returns are used to reduce nesting. Change-Id: I733adce5de15d345ee160a8b250133836e9d2873 Reviewed-on: https://pdfium-review.googlesource.com/30770 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-16Consolidate Black/Whitepoint parsing code CPDF_ColorSpace.Lei Zhang
Also use more constants. Change-Id: I02cb74d5ef5a44b1772d826be63ceb64b167c0db Reviewed-on: https://pdfium-review.googlesource.com/21913 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Remove CXMLdan sinclair
This CL deletes the CXML parser as it is no longer used. Change-Id: Ic4815b683515ee860a6ae5c7ca39e15573e584bc Reviewed-on: https://pdfium-review.googlesource.com/30694 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Put prototypes of PDF_NameEncode/Decode in fpdf_parser_utility.hTom Sepez
Because the implementations are in fpdf_parser_utility.cpp Add unit test for both. Change-Id: Ibae90ecbe625a035c450614ddbe7f5969f9f92aa Reviewed-on: https://pdfium-review.googlesource.com/30793 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Consolidate BlackPoint parsing code in CPDF_ColorSpace.Lei Zhang
Validate the values as well. Change-Id: I9c87ae9f67650f1f384b3e8a6ca80ea2f411fe50 Reviewed-on: https://pdfium-review.googlesource.com/30796 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Add Black/WhitePoint array constant in CPDF_ColorSpace.Lei Zhang
Change-Id: I7068735efc6ac41420901e068dbd40f684bb88b8 Reviewed-on: https://pdfium-review.googlesource.com/30795 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16More CPDF_Colorspace cleanup.Lei Zhang
- Mark subclass members as private. - Use more constants. Change-Id: Idc2bcb7dd2af3908d0ce1389d6832f3d6c434766 Reviewed-on: https://pdfium-review.googlesource.com/30794 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-16Update AUTHORS.Henrique Nakashima
Change-Id: I678b40f8cff3300bad1b3e1c5793f5907ba9c97f Reviewed-on: https://pdfium-review.googlesource.com/30610 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-16Convert CXFA_XMLLocale to CFX_XMLdan sinclair
This CL converts CXFA_XMLLocale to use CFX_XML instead of CXML. Change-Id: I1db617a658548ae5979f2f38d72c5b3000998663 Reviewed-on: https://pdfium-review.googlesource.com/30693 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-16Add CXFA_XMLLocale unittestsdan sinclair
This CL adds unittests for the CXFA_XMLLocale class. Change-Id: I1a610754933e5f33e87cb4c13b9bf540e366e6ed Reviewed-on: https://pdfium-review.googlesource.com/30692 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-16Check that CFX_DIBitmap::Create calls succeeds in fpdf_viewNicolas Pena
CFX_DIBitmap::Create returns false upon failure, so the return value of this method should be checked most of the time. This CL fixes the calls from fpdf_view.cpp. Bug: pdfium:983 Change-Id: I5782d2859c5b2a2e0c540b80510d7c98c01c04f3 Reviewed-on: https://pdfium-review.googlesource.com/30750 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-16Move CXML to be XFA onlydan sinclair
The remaining usage of CXML is in XFA. Move the code to be confined to the XFA build target while the last usage is removed. Change-Id: I0d48739364d2e4815749afe1ff402096f3f8f57c Reviewed-on: https://pdfium-review.googlesource.com/30691 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-16Revert "Return pdfium::span<char> from ByteString::GetBuffer()."Tom Sepez
This reverts commit 80a6cbe0a427e155de8555bc867af745d10f9777. Reason for revert: too many abrts in beta branch. TBR: dsinclair@chromium.org Bug: 832557, 832978, 832992, 833062, 833097 Change-Id: I7d511dbb224ddc644be96ea2f3770ad6f73debf5 Reviewed-on: https://pdfium-review.googlesource.com/30792 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-16Fix some nits in CPDF_ColorSpace.Lei Zhang
Change-Id: I23c8e82c31db0a5a0ed4cbe2131452a26492109b Reviewed-on: https://pdfium-review.googlesource.com/30714 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-16Fix a comment in CPDF_PatternCS.Lei Zhang
Change-Id: I276c726d0d657a23ac7a2202c2a5d1772d58c392 Reviewed-on: https://pdfium-review.googlesource.com/30713 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-16Remove CPWL_Edit rich text supportdan sinclair
This CL removes the code which attempts to provide rich text support for CPWL_Edit. The code, as written, doesn't actually work well. If you have tags under the <p> tag we will just lose the content (so <p><b>foo</b></p> would end up being a blank string). Multiple <p> tags get concatenated together with a \n, but we subsequently lose the \n later when we store the content into the VariableText object (so <p>foo</p><p>bar</p> becomes foobar instead of foo\nbar). We never read the "RV" field from the dictionary. The RV field is what actually stores the rich text value. So, we never set a rich text value into the text edit. Change-Id: Idc1d65e1b5d75380dd28c45bcbf9137a2a4cea9a Reviewed-on: https://pdfium-review.googlesource.com/30690 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-16Use CFX_XML instead of CXML in CPDF_Metadatadan sinclair
This CL converts CPDF_Metadata to use the CFX_XML classes instead of CXML classes. This also moves the CFX_XML classes from being XFA only to being used everywhere. Change-Id: Idb784f8aaa0bc843d8a3415ba5262ccf4949308a Reviewed-on: https://pdfium-review.googlesource.com/30650 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-16Fix UAF in CFGAS_FontMgr::FindFontchromium/3398Ke Liu
Fix an use-after-free issue which was introduced by commit 53279b1dcabae4913f7f0a58e741942e82ab7d59. Bug: chromium:832589 Change-Id: Id7da791c3aa2d71d0a9e56d062069f41b7eb48d1 Reviewed-on: https://pdfium-review.googlesource.com/30570 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-13Patch lcms to mark data structures as const.chromium/3397Lei Zhang
BUG=pdfium:1015 Change-Id: I6b49d4a63fa197b489f6ff2a6920b7e65bb1279d Reviewed-on: https://pdfium-review.googlesource.com/30672 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-13Fix integer overflow in CPDF_Font::FallbackFontFromCharcodeNicolas Pena
Bug: chromium:831583 Change-Id: Idc980ef47cdd942bddc75d9b7fe4a56bdeacdc1a Reviewed-on: https://pdfium-review.googlesource.com/30670 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-13Add test for circular CPDF_Function::Load().Henrique Nakashima
Bug: chromium:830221 Change-Id: Ia96086a1b930600a4fb9054123c867d1c8b301eb Reviewed-on: https://pdfium-review.googlesource.com/30671 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-04-13Add CPDF_ColorState::SetPattern().Lei Zhang
A common helper method for patterns, just like SetColor(). Change-Id: Iba6a9b33143d2d1278d05bbc2ce7e26b0ae5d197 Reviewed-on: https://pdfium-review.googlesource.com/30591 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-13Get rid of CPDF_Color::GetColorSpace().Lei Zhang
Replace it with more narrowly focused methods to get specific bits from the colorspace. Change-Id: Ifd2980f0fd06230d4d94d28eddf72219d2e9e6eb Reviewed-on: https://pdfium-review.googlesource.com/30590 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-13Add CPDF_Metadata unittestsdan sinclair
Add unittests for the CPDF_Metadata class. Change-Id: I1afeb0ab1434a1ebeb4f92bb91032a0f662e750d Reviewed-on: https://pdfium-review.googlesource.com/30630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Hide XML parsing inside CXFA_XMLLocaledan sinclair
This CL moves the parsing of the XML document into a static method of CXFA_XMLLocale. This removes the need for CXFA_LocaleMgr to care about the XML parser used. Change-Id: I04d14d78f458bfb37f0370fac2eb752e9840bfd6 Reviewed-on: https://pdfium-review.googlesource.com/30390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-13Move SharedForm check to CPDF_Metadata classdan sinclair
This CL moves code related to shared form detection into the CPDF_Metadata class. This allows us to hide the usage of CXML inside CPDF_Metadata. Change-Id: I547471a2bcc119221565c415a58211c1500cbb3c Reviewed-on: https://pdfium-review.googlesource.com/30370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Rename the other CPDF_Color::SetValue() variant.Lei Zhang
Rename it to SetValueForNonePattern() and combine the components parameters into a std::vector. Fix the callers to use std::vector as well. Change-Id: I0edd7e7876e47b56821e63cc5073fc21fd4098ee Reviewed-on: https://pdfium-review.googlesource.com/30470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-13Make CFX_XMLInstruction a subclass of CFX_XMLNodedan sinclair
The CFX_XMLInstruction handles the <?blah?> blocks at the top of an XML file. It was inheriting from CFX_XMLAttributeNode in order to store the tag name. This CL moves the tag name into CFX_XMLInstruction and subclasses from CFX_XMLNode. Change-Id: I8f7ff0dde19ed43b46d095b0d45df4bf06875af5 Reviewed-on: https://pdfium-review.googlesource.com/30490 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-12Add AsSpan() convenience method to fxcrt strings.Tom Sepez
Make consistent with StringView methods. Change-Id: Idf336895053a327262de924b6a525052e22a25da Reviewed-on: https://pdfium-review.googlesource.com/30491 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-12Rename one CPDF_Color::SetValue() variant.Lei Zhang
Rename it to SetValueForPattern() and combine the components parameters into a std::vector. Fix the callers to use std::vector as well. Change-Id: Ib3426e0ffdb164f0fbb10d462ad251bf91165925 Reviewed-on: https://pdfium-review.googlesource.com/30450 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>