summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-04-11Refactor CFX_Palettechromium/3069Nicolas Pena
The pointer members point to owned arrays. Avoid FX_Free in CFX_Palette. Use std::pair and avoid the use of a buggy quicksort. Change-Id: I5d5471d56dbfd32800e204c84664c436d1fbab08 Reviewed-on: https://pdfium-review.googlesource.com/4038 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-11Remove vestigial GYP_GONE test targets.jbudorick
BUG=pdfium:702 Review-Url: https://codereview.chromium.org/2814743003
2017-04-11Remove the STREAMTYPE define.Dan Sinclair
There are only two types of streams created _File and _Buffer. This CL simplifes the code by removing other stream types and removes code which is for those types. The CFGAS_Stream creation was also inverted to pass in the impl instead of accepting and setting the stream type. Change-Id: I73f207d0f458818ab59db915b256c6fdd633a336 Reviewed-on: https://pdfium-review.googlesource.com/4035 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Avoid long assignment chain in FM parserNicolas Pena
We only parse FM right before translating to JS. Our current implementation of assignment will duplicate to first expression's ToJavascript. So having a long chain of assignments will result in a huge ToJavascript. Bug: chromium:665087 Change-Id: I542371b5787113be2f2d686153ed0a6c48191bab Reviewed-on: https://pdfium-review.googlesource.com/4030 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-11Remove unneeded stream access flagsDan Sinclair
This Cl removes all of the steam access flags other then write. Flags which were always set were removed. Change-Id: I96df4fa0c95d89f4f454db050f3f032bc163e498 Reviewed-on: https://pdfium-review.googlesource.com/4034 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Remove unused loading code from IFGAS_StreamDan Sinclair
Remove unused loading methods, fold Create method back into caller. Change-Id: If3b7b3d1cdaf3d58fc7c07c3e96cf9ac89b61bd4 Reviewed-on: https://pdfium-review.googlesource.com/4033 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-11Disabiguate CreateStream callsDan Sinclair
This CL creates a CreateReadStream and CreateWriteStream method instead of having a single overloaded method. This removes the need for the cast at the call sites. The access parameter has been rolled into the method as it was always passed the same way to each Create*Stream method. Change-Id: I845951c3fe386b8051daf4f6b2ee5ba29b5c7d54 Reviewed-on: https://pdfium-review.googlesource.com/4032 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Guard against negative shift in nVal calculationDan Sinclair
It's possible for the nVal to become negative as it is shifted. This Cl changes nVal to be a checked_numeric and bails out if the shift is invalid. Bug: chromium:708504 Change-Id: Ia2ebbc828ece7f7d443432542784b39defe6a897 Reviewed-on: https://pdfium-review.googlesource.com/4010 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-10Remove unused CreateTextStreamDan Sinclair
This CL removes the CreateTextStream method as it is not called. Change-Id: I628aec2e8f488ad549b3497344ac08c5bb24de51 Reviewed-on: https://pdfium-review.googlesource.com/4014 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-10Remove unused CreateSharedStreamDan Sinclair
The CreateShreadStream code is not called, remove. Change-Id: I62871ce190e50598b7c82ab3b43355dbde6b8b4b Reviewed-on: https://pdfium-review.googlesource.com/4013 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Use checked_numeric to guard shiftDan Sinclair
It's possible for the RANGELEN[NTEMP] value to be larger then 32. This will make the shift invalid if the 1 is an int. This CL changes to 1L and uses the CheckedNumeric to validate that the result is inside the needed range for an int. Bug: chromium:708439 Change-Id: I1f0359985c2d7769367bd0edcf5e081f5bb58816 Reviewed-on: https://pdfium-review.googlesource.com/3991 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-10Do not treat push button as fillable fieldWei Li
Only fillable fields should show highlights. Push button should not do that. Doing so results in lighter color or extra layer of light color. BUG=chromium:638626 Change-Id: I6b4d129e1f60bf44ff5a297d4b9db823d6be8079 Reviewed-on: https://pdfium-review.googlesource.com/3790 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Wei Li <weili@chromium.org>
2017-04-10Guard against negative shift in jbig2 huffman initializationDan Sinclair
Depending on the code table, it's possible to have the largest PREFLEN value in the huffman table to be > 32. This will, potentially, cause the calcuation of ((FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1 to overflow the int value and cause a negative shift. This Cl checks the shift value and failes the initialization if we would shift a negative value. Bug: chromium:709781 Change-Id: Ia165a01ba9412e31c5e5a43717d415fcb42eafe5 Reviewed-on: https://pdfium-review.googlesource.com/3990 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Fix windows skia component builddan sinclair
The skia build on Windows is not producing a shared .lib file when building skia. This Cl updates the Skia component build to correctly generate the needed shared library. Bug: pdfium:701 Change-Id: I9545b8fcf76c8622624780ee3cc9ba794f4a842d Reviewed-on: https://pdfium-review.googlesource.com/3971 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Wei Li <weili@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-10Fix bytestring passing conventions, part 2.Tom Sepez
Change pass by reference to const reference or pointer. Change-Id: Ic007f14e6569679a846980a96cc627eac4ecd5d6 Reviewed-on: https://pdfium-review.googlesource.com/3953 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-10Remove unreachable code in CFX_ScanlineCompositorchromium/3068Nicolas Pena
m_Transparency is set in the Init method of the CFX_ScanlineCompositor. After the removal of the icc transform, it is clear that m_Transparency can only take values strictly less than 64. Change-Id: I6c33b9971b3b8a1ec45fbf50901f9815f323a2a5 Reviewed-on: https://pdfium-review.googlesource.com/3970 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-08Add title (/T) extraction for PDF tagged structureschromium/3067chromium/3066dan sinclair
This CL adds the ability to extract the title from a tagged structure element if one exists. Bug: pdfium:672 Change-Id: I22e2a8371db4f08b8a70dd77002f1befab97f530 Reviewed-on: https://pdfium-review.googlesource.com/3819 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-07Create initializer-list ctor for strings.Tom Sepez
Also use safe arithmetic for two-arg ctor. Change-Id: I5d541d9b2d5fe5b939f4cc8c22cf034f5cb01176 Reviewed-on: https://pdfium-review.googlesource.com/3955 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Cleanup string passing in core/fpdf*Tom Sepez
Return strings where possible. Add missing consts to strings passed by ref. Convert non-const cases to pointers. Rename a few methods to be clearer. Change-Id: I86569bc1744f539e6dd67fc73649b272c016328c Reviewed-on: https://pdfium-review.googlesource.com/3951 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-07Tweak CFDF_Font::AppendChar()Tom Sepez
Pass in/out argument as a pointer. Avoid pointless malloc just to copy in multibyte case. Then we can avoid special-casing the single-byte case. Change-Id: I3dd2d57e08ef6ad7b78ea38398b228fa41a9b3e6 Reviewed-on: https://pdfium-review.googlesource.com/3950 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Remove the ICC transform where it is never initialized.Nicolas Pena
- All callers of CFX_DIBitmap methods use nullptr as the ICC Transform. - The CFX_ScanlineCompositor is always initialized with a null ICC transform. Many of its methods call TranslateScanline from the ICC module. This method casts just uses ((CLcmsCmm*)pTransform)->m_hTransform, and this should not be done when pTransform is nullptr. Change-Id: I1b846d1f20699fa017cb9a276be3214eb8fabd4b Reviewed-on: https://pdfium-review.googlesource.com/3931 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-07Remove the "old way" of performing FlateUncompress.Tom Sepez
Repeated looping over Realloc() with a linearly increasing buffer size is going to be O(N^2) which is why it was limited to small cases. But it's wrong to do it anyways, and it kicks out a lurking issue in PartitionAlloc as it turns out. See https://crbug.com/709271, but this doesn't actually fix that issue, it just avoids it. Change-Id: I39d8f8df0d5fc358b7b9caa15c507a8f57e45004 Reviewed-on: https://pdfium-review.googlesource.com/3910 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-07Gitignore jinja2 and markupsafeNicolas Pena
Change-Id: I9c05ddc2ca2e3377cc8a9d13c3e4faa2f17a49a5 Reviewed-on: https://pdfium-review.googlesource.com/3930 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-07Use libjpeg-turbo instead of our own copy of libjpeg.Lei Zhang
Check out libjpeg-turbo via DEPS. Also checkout yasm via DEPS and copy some yasm build files from Chromium. BUG=chromium:541704,pdfium:389 Change-Id: Ic7af415f002a3ca2acd9223ed3474dedf3930b32 Reviewed-on: https://pdfium-review.googlesource.com/3470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-07Use CFX_MaybeOwned on the buffer of CFX_DIBitmapNicolas Pena
Change-Id: Ia4181a2838de60e4e177165b3689338c86f45771 Reviewed-on: https://pdfium-review.googlesource.com/3817 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Fix unit tests to initialize PartitionAlloc.Chris Palmer
Tests need to be subclasses of FPDF_Test. BUG=pdfium:700 Change-Id: I317ec2c49567e58cb57c6222e387574226f594b3 Reviewed-on: https://pdfium-review.googlesource.com/3890 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-04-06Clean up CBC_QRCoderVersion and friends.Lei Zhang
Change-Id: Iff738c99fb4fe38d35515c280057b489624d734f Reviewed-on: https://pdfium-review.googlesource.com/3752 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-06Remove stale gn arg to avoid undeclared argument warning.chromium/3065Dale Curtis
v8_enable_inspector was removed recently. Clean up remnants. BUG=645890 TEST=none Change-Id: I501d33bfaa1bf0a03f83b9ed3b4b183301d38d63 Reviewed-on: https://pdfium-review.googlesource.com/3871 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Cleanup CFX_BitmapComposerNicolas Pena
Remove default params, use more unique_ptr, and fix some nits. Change-Id: I4ed9a576fb3ebd9afd64c6544d1f6a1103e9d270 Reviewed-on: https://pdfium-review.googlesource.com/3872 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Cleanup nits from previous XML Cldan sinclair
Change-Id: I1e0b84a8b208d92aff3f02b6461b3a20f60f4d1e Reviewed-on: https://pdfium-review.googlesource.com/3870 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-06Cleanup tagged code.dan sinclair
This Cl removes a bunch of unused tagged code. Some of this will need to come back in the future (like the attr code) but we can add it back with tests when needed. Bug: pdfium:672 Change-Id: I7aaed79963910b336f42ce665790408038c39ba4 Reviewed-on: https://pdfium-review.googlesource.com/3830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-06Cleanup the tagged codedan sinclair
This CL removes the IPDF_Struct* classes in favour of their only implementation. The tagged code was split out into files matching the classes they contain. The friendship between CPDF_StructTree and CPDF_StructElement was broken in favour of accessors. Bug: pdfium:672 Change-Id: Iade83b608fb7168b3b0f41338d10d5fd8ab91a6e Reviewed-on: https://pdfium-review.googlesource.com/3820 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-06Remove the length reference from XMLSyntaxParserdan sinclair
This Cl removes the reference to the length of the CFX_BlockBuffer that was stored and manipulated in CFDE_XMLSyntaxParser. Methods have been added to BlockBuffer to satisify the usages in the syntax parser. Change-Id: I1107c343ce267283c4c45aa3ae1bbfa93c24079f Reviewed-on: https://pdfium-review.googlesource.com/3816 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-06Change the CFDE_XMLSyntaxParser start and end typesNicolas Pena
This CL changes m_pStart and m_pEnd to FX_FILESIZE. This is the appropriate type because the values are used as such by the CFDE_XMLParser. Change-Id: I6988c5e520f52c39053d682d9e2ce713883c8b54 Reviewed-on: https://pdfium-review.googlesource.com/3850 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-06Convert XMLSyntaxParser buffer to vector.dan sinclair
This Cl updates the m_pBuffer pointer to a vector. Change-Id: Ib971d224376122a1d5ebf5bb0e712db552df2342 Reviewed-on: https://pdfium-review.googlesource.com/3815 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-06Change some fxbarcode to use return values.Lei Zhang
No caller cares about the exception values anyway. Remove the unused ones. Also use more std::unique_ptr to stop potential leaks. Change-Id: Ic5955fb0d879f55e1c6a005c0204df50246dab19 Reviewed-on: https://pdfium-review.googlesource.com/3715 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-05Use unique_ptr in the children of CFieldTree::Nodechromium/3064Nicolas Pena
Change-Id: I149718bbdb7195223012150d6162d73cbeb3b8cc Reviewed-on: https://pdfium-review.googlesource.com/3813 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-05Merge XMLSyntaxParser Init into constructorDan Sinclair
This Init() method is always called right after construction. Merge together for clarity. Change-Id: Iab5bfe937e82b7a310e373dd139399bc1be7cea6 Reviewed-on: https://pdfium-review.googlesource.com/3814 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-05Update to make show structure clearerDan Sinclair
Change-Id: I0b52246e72fb2243288e8edef361d47bc00b9469 Reviewed-on: https://pdfium-review.googlesource.com/3812 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-05Update XML syntax parser to return stringsDan Sinclair
This Cl updates the CFDE_XMLSyntaxParser to return strings instead of taking out parameters. Change-Id: I51124d8d961c00a72987c1a21025d0626b965fab Reviewed-on: https://pdfium-review.googlesource.com/3754 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-05Libtiff: Prevent OOM in TIFFFillStripNicolas Pena
In TIFFFillStrip, calls to TIFFReadBufferSetup may allocate large amounts of memory. In this CL we do sanity checks on the claimed size of the raw strip data before that happens, to prevent out-of-memory. Bug: chromium:707431 Change-Id: I4e7c9a8630fad11d4f68a3ceccd71ffa511f4293 Reviewed-on: https://pdfium-review.googlesource.com/3811 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-05use freetype if windows font decode failsCary Clark
If windows is unable to resolve the font stream, use the custom empty handler instead, which maps to freetype. R=dsinclair@chromium.org,bungeman@google.com Bug:chrome:705580 Change-Id: Ib1732f29f462fc5d5e42329088c80c83abe3ea25 Reviewed-on: https://pdfium-review.googlesource.com/3771 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-04-05Check first then cast in XFA_FDEExtension_ResolveNamespaceQualifierTom Sepez
Bug: 708383 Change-Id: I6d59fb40bbddd4bdc7224d72bfb789d360f029ca Reviewed-on: https://pdfium-review.googlesource.com/3770 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-05Move XML attribute handling to a base class.Dan Sinclair
This CL moves the attribute handling out of CFDE_XMLElement and CFDE_XMLInstruction into a common CFDE_XMLAttributeNode. The handling is also converted to a std::map from either a) a vector storing name,value,name,value or b) two vectors one for names and the other for values. The unused Get/Set methods for interger and float are removed and the iteration is converted to use iterators. Change-Id: Icda00ae898a595d58b06af0ced337f55f47c317c Reviewed-on: https://pdfium-review.googlesource.com/3753 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-05Add option to pdfium_test to dump structure elementsDan Sinclair
This Cl adds a --show-structure to pdfium_test which will dump out the StructElement items for the selected pages. Bug: pdfium:672 Change-Id: I90aceda71c13c54abfe4ac242a62375643cdfd9d Reviewed-on: https://pdfium-review.googlesource.com/3750 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-05Add public method FPDFPath_GetFillColor to get fill color of a path object.Miklos Vajna
It was already possible to set the fill color, this is the other direction. Change-Id: Id53f3c9969ca036ec1f9383a2cdbaf224395215f Reviewed-on: https://pdfium-review.googlesource.com/3690 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-05Fix assignment to len.dan sinclair
Sigh, messed up std::min conversion. TBR=npm@chromium.org Bug: pdfium:697 Change-Id: I0091f178b08fa537ebc3962d9349eb46d0aa8a80 Reviewed-on: https://pdfium-review.googlesource.com/3751 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-05Use correct length in guard checkdan sinclair
When fixing https://crbug.com/672177 we added a guard that we aren't reading off the end of the file. That guard used the file access Position(). This is the wrong value to compare against as our read position and the file access Position may be different. This CL updates the check to use the correct current file position. Bug: pdfium:697 Change-Id: I68a5eaed2f1f3d65422605f0a8474144cfa7d172 Reviewed-on: https://pdfium-review.googlesource.com/3711 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-04Clean up QRCoderBitVector.Lei Zhang
Use std::vector and return booleans results when possible. Change-Id: If3ce4559f137fb449fd1ab818750558a1b5f8df0 Reviewed-on: https://pdfium-review.googlesource.com/3561 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-04Remove a couple checks for MakeUnique failures.Lei Zhang
Combine some common CCodec_Jbig2Module code. Change-Id: I9a046314bc0e9dddc9a8c1a06b37764e9f3cc4b6 Reviewed-on: https://pdfium-review.googlesource.com/3713 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>