summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-04Cleanup more null IFX_Pause parametersDan Sinclair
This Cl cleans up more IFX_Pause parameters which are always null. Change-Id: Ia48600f06216db64a2db8e6e97222a91bd4ba149 Reviewed-on: https://pdfium-review.googlesource.com/4890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-04Remove some unused IFX_Pause paramsDan Sinclair
This Cl removes IFX_Pause parameters which are always null. Change-Id: I6d36e52380a8f688c5e20f5e19c671f3bcc12868 Reviewed-on: https://pdfium-review.googlesource.com/4874 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-04More cleanup in CFX_ScanlineCompositorNicolas Pena
This CL does more cleanup in CFX_ScanlineCompositor: - Use private initization methods instead of passing member refs to namespace. - Own the m_pSrcPalette properly by getting rid of the raw pointer. - Remove members that are unused. - Fix some nits. Change-Id: I2447032f8f92614dc026f62bd0cdcd2204ab37de Reviewed-on: https://pdfium-review.googlesource.com/4851 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04CPDF_DataAvail: avoid reads into stack buffers.Tom Sepez
Not a good practice even with correct bounds checks. Same idea for fpdf_edit_create.cpp Change-Id: I90b869ae4a07eb60d59997b9c5afc14830efc076 Reviewed-on: https://pdfium-review.googlesource.com/4830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-04Move O_BINARY and O_LARGEFILE defintionsTom Sepez
No code needs this execpt one file. Change-Id: Ibceb33259f5a3635de36a272ebd49ef572004cbc Reviewed-on: https://pdfium-review.googlesource.com/4832 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-04Remove FXSYS_wfopen(), it is totally unused.Tom Sepez
Change-Id: I612d9eaa47f6e4b023a49ab9120372de3d73cdc7 Reviewed-on: https://pdfium-review.googlesource.com/4831 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-03Clean up CRYPT_ArcFourCrypt().Lei Zhang
Add a unit test too. Change-Id: I33bf1aea85aff3de50021462095b76edd4017f97 Reviewed-on: https://pdfium-review.googlesource.com/4870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-03Actually build fuzzers with the pdfium_all target.chromium/3089Lei Zhang
Change-Id: Icc6b62f92d1a82ec60d1dd463d93376088017827 Reviewed-on: https://pdfium-review.googlesource.com/4792 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-03CPDF_SyntaxParser::SearchWord() is always backwards and for whole-wordsTom Sepez
Change-Id: Ic31d9cda5e919a754162e14e69cb63671a3fe8b9 Reviewed-on: https://pdfium-review.googlesource.com/4794 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-03SetPos to at most the file length to avoid overflowsNicolas Pena
This CL prevents arbitrary position setting which may cause integer overflows. In the bug in question, the PDF says the xrefs are located in a huge position. This then causes problems when calling CPDF_SyntaxParser methods. Bug: chromium:603545 Change-Id: I5f94c38f46a0217e9f12f1bf8b2f3bee3b03cb35 Reviewed-on: https://pdfium-review.googlesource.com/4813 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-03Use enum class GifDecodeStatus instead of integers in fx_gifNicolas Pena
Change-Id: If37147f513a87bafb3299a493393a6bc44165dbe Reviewed-on: https://pdfium-review.googlesource.com/4811 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-03Add a ToUnicode mapping when loading CID fontsNicolas Pena
This CL adds ToUnicode for CID fonts and adds a test to prove that using it works as intended. The test uses a Linux font for Japanese characters, and tests for other OS will be added in a followup. The ToUnicode works by defining the PDF charcodes as equal to the glyph indices and assuming that the freetype charcodes given by FXFT_Get_Next_Char are in fact the unicode values. Bug: pdfium:667 Change-Id: I419724b87c3936c730a05f771548ae4787a576eb Reviewed-on: https://pdfium-review.googlesource.com/4810 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-03XFA Nits: Dead CreateCharIter(), auto CFXJSE_Value unique ptr.Tom Sepez
Change-Id: I2525684dd5662ef9cb95f63a68443faa97f4e25b Reviewed-on: https://pdfium-review.googlesource.com/4812 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-03Add a unit test for CRYPT_ArcFourSetup().Lei Zhang
BUG=chromium:686128 Change-Id: Iad3ebbfd304dc145af2e694818864c4d25ccf99a Reviewed-on: https://pdfium-review.googlesource.com/4793 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-02Remove some more |new|s, part 11chromium/3088Tom Sepez
Using vector<uint8_t> as a buffer. Change-Id: I38a8a05e7ec1355980d17533a2c8336e733aa6f6 Reviewed-on: https://pdfium-review.googlesource.com/4791 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-02CRYPT_ArcFourSetup: don't use key[0] when length is 0Tom Sepez
Bug: 686128 Change-Id: Ie8d71d7c0b76abb3f39ea2ea5ce43c82994a047a Reviewed-on: https://pdfium-review.googlesource.com/4750 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-02Remove some |new|s in cpdfsdk_formfillenvironment.cpp and cpdfxfa_context.cppTom Sepez
Use std::vector<uint8_t> as buffer instead. Change-Id: I710fe87f292b2c0f838410e9c7ff615c27c589a6 Reviewed-on: https://pdfium-review.googlesource.com/4790 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-02Roll FreeType to 5a3490e.Lei Zhang
This follows Chromium's FreeType DEPS roll. Potentially addresses Clang on Windows LLP64 build failure. Roll testing corpus to 5379e0a with updated expectations. BUG=pdfium:705 Change-Id: Ie494b68a52f953436accf8fd1961244f70a92cab Reviewed-on: https://pdfium-review.googlesource.com/4632 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-02Pass explicit string size in EncodeToCodewords().Lei Zhang
The input wchar_t array is not NUL-terminated. BUG=chromium:716706 Change-Id: I0a89324fa46a56a39cc3331fcdd1c26b1550828b Reviewed-on: https://pdfium-review.googlesource.com/4631 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-02Change BarcodeTest to render to bitmaps.Lei Zhang
BarcodeTest renders to bitmaps verifies their checksums. Add some commonly used checksumming code to testing/test_support.h, and use it in tests that have duplicate code. Change-Id: I4a440674ff1084685b5d89576d967333da458a8a Reviewed-on: https://pdfium-review.googlesource.com/4618 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-02Add API to create a text object using a loaded font.Nicolas Pena
There is already a method to add text from standard font, this CL adds an option to add text using a loaded font. The font set into a text object is ref counted and may be released, so call LoadFont on this new text obj, and add a method to close the font. This CL also improves the SetText method so that it now uses a WideString, in preparation for CID fonts with non-Latin characters. Bug: pdfium:667 Change-Id: I6829d702357d2a898a12f5297e4fd2ec993a9891 Reviewed-on: https://pdfium-review.googlesource.com/4770 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-02Tag FXJSE's V8 objects as such.Tom Sepez
There are two APIs to V8 from pdfium: FXJS and FXJSE (for XFA). Previously, we put tags in internal fields for FXJS's objects. Now do the same for FXJSE. Bug: 713998 Change-Id: Ife4f616df3768db566b996dedc1da104f8d3fb93 Reviewed-on: https://pdfium-review.googlesource.com/4475 Reviewed-by: Jochen Eisinger <jochen@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-02Fix some nits in fx_gif.cppNicolas Pena
Change-Id: I7d2d731b8b18d315b5587e1d0d9737c08cbcdead Reviewed-on: https://pdfium-review.googlesource.com/4710 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-02Remove more |new|s, part 8Tom Sepez
Change-Id: I0e3f4bd33e66fd48db8371a5cc2f8db964720d08 Reviewed-on: https://pdfium-review.googlesource.com/4731 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-02Remove more |new|s, part 7Tom Sepez
Remove some dead code along the way. Move some getters to headers and make const. Change-Id: I14280c247b0cfeff8ad7f606302bc8bba1960f1e Reviewed-on: https://pdfium-review.googlesource.com/4730 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-01Remove more |new|s, part 6chromium/3087Tom Sepez
Change-Id: I4adbeafa7ecfd509abca08d97be132fd709e1261 Reviewed-on: https://pdfium-review.googlesource.com/4691 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-01Remove more |new|s, part 5Tom Sepez
Many of these are already unique_ptrs. Change-Id: I3695d4ff5a8f7483ad994ac7657897fd55069cd5 Reviewed-on: https://pdfium-review.googlesource.com/4690 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-01Fix CGifLZWDecoder::Decode comparisonNicolas Pena
Only use code_end to finish the decoding. Remove ASSERT from DecodeString since it may be triggered. The following if statement handles that case anyways. Bug: pdfium:707 Change-Id: Id6ec3c66d0e43c46308b4c3416da6c482ceafc69 Reviewed-on: https://pdfium-review.googlesource.com/4670 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-01Add PDF reference to CFX_Matrix commentNicolas Pena
Change-Id: I801f3cf11a27f91fa3e75518143f953050b2f607 Reviewed-on: https://pdfium-review.googlesource.com/4650 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-29Fix rotationschromium/3086chromium/3085rbpotter
Normalize rotations read from PDF documents. Make FPDFPage_GetRotation always return a value 0 to 3 as specified in fpdf_edit.h instead of returning the page rotation / 90 (page rotation may be negative for some PDFs). BUG=chromium:713197 Change-Id: Ie477803f7d298b777a3ace89b21cfda8b7f6808b Reviewed-on: https://pdfium-review.googlesource.com/4532 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-28Clean up private methods in CBC_C40Encoder.Lei Zhang
Change-Id: I0c33ec81ef9fd3ff7c22f33f5647a923aecd3e77 Reviewed-on: https://pdfium-review.googlesource.com/4594 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-28Remove some more |new|s, part 4.Tom Sepez
FindMatchingDataNode(): The callers that passed null iterators, triggering the new, are perfectly capable of making their own iterators. Change-Id: I712fa36667d6070b43f237916e448d518e8855c2 Reviewed-on: https://pdfium-review.googlesource.com/4616 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-28Limit recursion in CXML_Parser::ParseElement().Lei Zhang
BUG=chromium:716526 Change-Id: Idbe4624ab2193cee2931c69ed023dd2c1679d124 Reviewed-on: https://pdfium-review.googlesource.com/4615 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-28Disallow CPDF_FormField with deep node trees.Lei Zhang
Otherwise the destruction can stack overflow. BUG=pdfium:716525 Change-Id: I415176a361a0fc2310d3671c1c0e804d11a98261 Reviewed-on: https://pdfium-review.googlesource.com/4613 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-28Remove more |new|s, part 3Tom Sepez
These are already unique_ptr's, we should make them as such. Change-Id: I576396d73c1d39e7a3bc8f91e8530d2e08883213 Reviewed-on: https://pdfium-review.googlesource.com/4614 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-28CXFA_FMStringExpression: int16_t is not a good type for a string index.Tom Sepez
Use early return while we're at it. Bug: 716519 Change-Id: I4630d8b6121266c76a53f0171ba6dfd307da725a Reviewed-on: https://pdfium-review.googlesource.com/4611 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-28Remove dead dimensions code in fxbarcode.chromium/3084Lei Zhang
Remove more exceptions. Change-Id: I3b8b8b9837b0010b1e0060ddd56e93c78f9f0fb5 Reviewed-on: https://pdfium-review.googlesource.com/4410 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-28Fix stack overflow in CFieldTree::Node::GetFieldInternal().Lei Zhang
Limit recursion depth, just like in CountFieldsInternal(). BUG=chromium:716523 Change-Id: I70c052347a1d8fb9a4dbc065a1c9af55c02818f2 Reviewed-on: https://pdfium-review.googlesource.com/4612 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-27Assert CPDF_Pattern always has a valid CPDF_Document pointer.Lei Zhang
Same for CPDF_DocPageData. Change-Id: I8f2f559123dbb2f3623d957e4074d5f9d191797f Reviewed-on: https://pdfium-review.googlesource.com/4501 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-27Zero 4 byte variable before reading 3 bytes into itTom Sepez
Otherwise, the top byte will be unitialized. We later mask it off, but MSAN isn't clever enough to realize this. Bug: 716207 Change-Id: Ic4513bbaee6a47654392580d5f404195da4a6509 Reviewed-on: https://pdfium-review.googlesource.com/4591 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-27Add barcode test skeletonTom Sepez
Individual tests need some more fleshing out. Fix spelling of "Destroy" while we're at it. Bug: pdfium:699 Change-Id: I05f1da8654bfdf92cb264adae16e1b3209587a31 Reviewed-on: https://pdfium-review.googlesource.com/4550 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-27Remove CBC_HighLevelEncoder::illegalCharacter().Lei Zhang
It always return a failure. Change-Id: Ib318bbdb99b3ea38fba8ceb5733c6dcb8f14bbbf Reviewed-on: https://pdfium-review.googlesource.com/4590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-27move pdfium skia build forward to match chromechromium/3083Cary Clark
see https://codereview.chromium.org/2843823003/ skia is relying on vulkan in ToT so add that to pdfium's BUILD.gn. Even if pdfium's skia DEPS doesn't have third_pary/vulkan, no one seems to mind that the include directory doesn't exist. R=dsinclair@chromium.org Change-Id: I1363f158755caa5e45031c84c1687134096b3ba2 Reviewed-on: https://pdfium-review.googlesource.com/4570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-04-27Remove more |new|s, part 2Tom Sepez
Change-Id: I13b43ceafc6a35bcc1e366546a4a408ea01fe4ab Reviewed-on: https://pdfium-review.googlesource.com/4534 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-26Remove a few more |new|s.Tom Sepez
Change-Id: I8a50ed680c1e101f855644fca8d282dd21470577 Reviewed-on: https://pdfium-review.googlesource.com/4533 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-26Avoid unordered_set and maps for the time being.chromium/3082Tom Sepez
See discussion at https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/rdxOHKzQmRY Change-Id: I1803ae97c39b592001835814e2f6674b2c7cb3ea Reviewed-on: https://pdfium-review.googlesource.com/4531 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-26Guard against overflow in CFX_BilinearMatrix code.Dan Sinclair
If any of the values in the matrix used to initialize the CFX_BilinearMatrix are close to INT_MAX then the numbers can overflow when multipled causing undefined behaviour. This Cl uses a pdfium::CheckedNumeric to handle the multiplications and then assigns back to the int value if valid. Bug: chromium:702041 Change-Id: Ia1895e2e39c0ac2bf099d45f97e33209cb50d134 Reviewed-on: https://pdfium-review.googlesource.com/4495 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-26Remove CPDF_Document parameter from CPDF_DeviceCS ctor.Lei Zhang
It is always NULL. Change-Id: Iebfb3bc645aebe05335f88d536164a55a7140539 Reviewed-on: https://pdfium-review.googlesource.com/4510 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-26Get rid of a few |new|s in CPDF_Document.Tom Sepez
The chain of destructors may attempt to use m_pDocPage after it has been set to null by the unique_ptr destructor. Verify it is still present before using it from any code that may be called from some other CPDF_ destructor. Change-Id: I007160231d73feed85d90efc687d6da993653f96 Reviewed-on: https://pdfium-review.googlesource.com/4499 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-26Fix botched negation in cpdf_imageobject.cppTom Sepez
Regressed at https://pdfium.googlesource.com/pdfium/+/7d4f6a89d7e2c5d13b7d630d6348950044a5465e TBR=thestig@chromium.org Change-Id: I25b8d6b4847090af18c9f36e4cea07a1eeb2a99a Reviewed-on: https://pdfium-review.googlesource.com/4500 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>