summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-05-05More unused IFX_Pause parameters removedchromium/3091Dan Sinclair
Remove IFX_Pause parameters which are passed but not used. Change-Id: I51a491c7f9a429676d114a387390fac3ae65e187 Reviewed-on: https://pdfium-review.googlesource.com/4950 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-05Fix CPDF_CMap::m_pAddMapping lack of type information.Tom Sepez
Using a ByteBuffer and an array of uint8_t's isn't how one would represent an array of structured data. Packing uint16_t's into a uint32_t via / and % isn't ideal, either. Bug: Change-Id: Ib09ae2659ba2f027724546bb7aef99bdfd2dea25 Reviewed-on: https://pdfium-review.googlesource.com/4951 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-04Give a couple of char to int functions better names.chromium/3090Lei Zhang
- FXSYS_toDecimalDigit() becomes FXSYS_DecimalCharToInt(). - FXSYS_toHexDigit() becomes FXSYS_HexCharToInt(). Change-Id: If4683e8f85f05124b92ff075056cbc295442087d Reviewed-on: https://pdfium-review.googlesource.com/4930 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-04CPDF_Document::GetPageData() normally does not return NULL.Lei Zhang
Add a comment to clarify and remove some unneeded checks. Change-Id: I8b0492548b245abc45e161085047c9f36d6c8e2b Reviewed-on: https://pdfium-review.googlesource.com/4871 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04Make CPDF_Font member variables protected.Lei Zhang
Change-Id: I5d452ea907f4d243645ddae3512776096a827522 Reviewed-on: https://pdfium-review.googlesource.com/4872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-04Remove unused IFX_Pause memberDan Sinclair
The IFX_Pause param is stored but never used. Remove. Change-Id: I9e5298fc05c6d408873b7bee307a76dcf3d2d4da Reviewed-on: https://pdfium-review.googlesource.com/4931 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-04Cleanup CFX_CharMapDan Sinclair
This CL removes the CFX_CharMap class and moves the two static methods into the files in which they're used. Change-Id: I8ff7cbfd7f1ef3970e39c77ffa3439099f7fec02 Reviewed-on: https://pdfium-review.googlesource.com/4873 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-04Remove CFX_GlyphMapTom Sepez
It's only instantiated in one place, and then nothing is ever put into the map. Change-Id: I8ebee324e0ec63c139309275c8de115d38063dc6 Reviewed-on: https://pdfium-review.googlesource.com/4877 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-04Removing unused IFX_Pause parametersDan Sinclair
Remove more IFX_Pause parameters which are not used. Change-Id: I9d10bb6b28d6d4d94ec3c4241b1c5a8a0709264c Reviewed-on: https://pdfium-review.googlesource.com/4875 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
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-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 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-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-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-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-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-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-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-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>
2017-04-25Use unique_ptr in CFPF_SkiaDeviceModuleTom Sepez
Change-Id: Ie50deca34dd3c122efb483ef210f96798abe9e4e Reviewed-on: https://pdfium-review.googlesource.com/4498 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-25Use unique_ptr for CFX_GEModule::m_pFontCache.Tom Sepez
Change-Id: I656e8028001fadd7869a08593f10b0b8e25fe01c Reviewed-on: https://pdfium-review.googlesource.com/4497 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-25Remove remaining ICodec_* abstract classesTom Sepez
They are only implemented in one way, and the layering does not required an interface here. Change-Id: Id87591ca237fb66dbfc5aa62b4cc11c2464f5ffa Reviewed-on: https://pdfium-review.googlesource.com/4496 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-25Add unittest for matrix reverseDan Sinclair
This Cl adds some unit tests for the CFX_Matrix Reverse method. Bug: chromium:702041 Change-Id: I9598d3eb48d6b86a3e192d313fe1091bd29a4701 Reviewed-on: https://pdfium-review.googlesource.com/4492 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-25Add comment to CFX_Matrix to record component positions.Dan Sinclair
This Cl adds a simple comment to CFX_Matrix to record which positions in the 3x3 matrix each of the letters denotes. Change-Id: Ie733657e6072e2148406d43f06fbd883b34bf573 Reviewed-on: https://pdfium-review.googlesource.com/4490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-25Rename fx_basic_memmgr.cpp to fx_memory.cpp to match .h namingTom Sepez
Change-Id: I769d7f2c52b0a0db36be6145bfb626c126a58be9 Reviewed-on: https://pdfium-review.googlesource.com/4480 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-25Rename core/fxcrt/fx_basic_coords.cpp to fx_coordinates.cppTom Sepez
Its contents are delcared in fx_coordinates.h Remove unused GetIntersection(). Move FXSYS_round to fx_system.cpp. Change-Id: I70749581d1321dd919e35fa2daab9591098f68e9 Reviewed-on: https://pdfium-review.googlesource.com/4479 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-25Delete some CFX string ctors.Lei Zhang
Prevent implicit construction of CFX_WideString from non-wchar_t variables. Similarly prevent implicit construction of CFX_ByteString from non-char variables. Fix up CBC_OnedCodaBarWriter which tries to do the above, and simplify code there using pdfium::ContainsValue(). Same for CPDF_FileSpec. Change-Id: I3db7125a68ef3f64c2f235d38e974767cd083dc3 Reviewed-on: https://pdfium-review.googlesource.com/4478 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-25Use fx_extension.h utilities in more places.Lei Zhang
Change-Id: Iba1aa793567e69acc3cc1acbd5b9a9f531c80b7a Reviewed-on: https://pdfium-review.googlesource.com/4453 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-24Add FXSYS_wcsftime() to avoid termination on win.Tom Sepez
Bug: 712725 Change-Id: I3384385176410964a87b12c2587f68247ea80cc9 Reviewed-on: https://pdfium-review.googlesource.com/4454 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-24Use a pdfium-specific unittest main rather than gtest'sTom Sepez
We must initialize our partition allocator before calling into any test cases. We can then remove the FPDF_Test class, which did the same thing. Change-Id: I614480fa474b2032052857a02e94781f15a27a4e Reviewed-on: https://pdfium-review.googlesource.com/4473 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>