summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-25Simplify CBC_OnedCode128Writer methods.chromium/3081Lei Zhang
Change-Id: I963fcf416f623efd89832f61914df115b443a52c Reviewed-on: https://pdfium-review.googlesource.com/4494 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: 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-25Use unique_ptr in CXFA_ScriptContext::m_mapVariableToContext.Tom Sepez
Remove unused CFXJSE_Arguments::GetRuntime(). Remove some default argument values. Make members of CFXJSE_Context private. Change-Id: Id21951f7d8d68929b2799a9d6a2cdd7a3677f52a Reviewed-on: https://pdfium-review.googlesource.com/4493 Commit-Queue: Tom Sepez <tsepez@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 test for bug 714187Dan Sinclair
This CL adds a minimized test case for https://crbug.com/714187 in order to keep it from regressing in the future. Bug: chromium:714187 Change-Id: I913f380c85a57621424d82165393b1616c2f6a9a Reviewed-on: https://pdfium-review.googlesource.com/4491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-25Fix a self-inclusion in third_party/base/stl_util.h.Lei Zhang
Change-Id: I7a2fc956236005fca4848bd2be6db4585bc4e7d7 Reviewed-on: https://pdfium-review.googlesource.com/4477 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@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-25Test more OnedCode128WriterTest methods.Lei Zhang
Change-Id: Ifc6e98af8e9f8505edce8b04836fbe0d6ab5743d Reviewed-on: https://pdfium-review.googlesource.com/4476 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-25Use fx_extension.h utilities in more places in xfa/Lei Zhang
Change-Id: Id58c313aa446ecfa223e5c8edc095586b62a61fa Reviewed-on: https://pdfium-review.googlesource.com/4455 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@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 tests for BC_OnedCode128Writer encoding functions.Lei Zhang
Make encoding functions return pattern indices instead of pattern pointers for easier testing. Also remove some dead code. Change-Id: Ib80d84b2e6828bbc8920b931d77bbcd82427f01a Reviewed-on: https://pdfium-review.googlesource.com/4474 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@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>
2017-04-24Use unique_ptr in CFX_SizeGlyphCacheTom Sepez
Fix illegal leading underscore in class name while at it. Change-Id: Idd138eb42f4a0676552aa02d7dda4c29d1877348 Reviewed-on: https://pdfium-review.googlesource.com/4438 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-24Nit cleanup in XFA widget codeDan Sinclair
This Cl cleans up nits in the remaining XFA widget code. Change-Id: I10f33ee2ab0ebdb06aeee582a04188fbd7a8bf9e Reviewed-on: https://pdfium-review.googlesource.com/4472 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-24Initialize colour valueschromium/3080Dan Sinclair
The colour values returned from the ColorSpace GetRBG methods may not have set a value. This CL updates the CPDF_MeshStream to always initialize the values to 0 so they can't be used uninitialized. Bug: chromium:714074 Change-Id: Id2db5eabe31d2ff19f9330b2bc5c681680cf461d Reviewed-on: https://pdfium-review.googlesource.com/4450 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-24Cleanup the XFA Bacode widgetDan Sinclair
This Cl cleans up the XFA barcode widget. The custom binary search is removed. Some code shuffled from the header to the cpp file. Nits fixed. Change-Id: Icad0d2b25b07ea36afc5a5922a79f55b82616486 Reviewed-on: https://pdfium-review.googlesource.com/4394 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-21Use unique_ptr in CFX_FolderFontInfo::m_FontListchromium/3079Tom Sepez
Avoid a string duplication along the way. Change-Id: I866c34ad1afb20b9578aeb7cabeb8a185674c884 Reviewed-on: https://pdfium-review.googlesource.com/4437 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-21Use unique_ptr in CFX_FontMgr::m_FaceMap.Tom Sepez
Change-Id: Ie34942e6e577dfa270417b17c59a51813f310d27 Reviewed-on: https://pdfium-review.googlesource.com/4436 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-21Add CFX_RenderDevice::AutoRestorer()chromium/3078Tom Sepez
Avoid cleanup on every return path. Change-Id: I6978adb6f31020d812ac88c5d46c703d1461d373 Reviewed-on: https://pdfium-review.googlesource.com/4435 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-21Return unique_ptr from CPDF_Type3Cache::RenderGlyph().Tom Sepez
Change-Id: I0701c6e5a9c1789f5fe929778df0e2aa55d8bf00 Reviewed-on: https://pdfium-review.googlesource.com/4434 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-21Return unique_ptr from CPDF_RenderStatus::CloneObjStates().Tom Sepez
Tidy a few nits along the way. Change-Id: Ia330464e787dc584004896d2b09c228dc2d6bbc3 Reviewed-on: https://pdfium-review.googlesource.com/4433 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-21Revert "Compare to epsilon instead of 0 in CFX_Matrix::SetReverse"Nicolas Pena
This reverts commit fbd9ea1db2f1bb7fa006e7304a1202afc683c142. Reason for revert: This check seems too strict BUG=chromium:714187 Original change's description: > Compare to epsilon instead of 0 in CFX_Matrix::SetReverse > > Since we are going to divide i by 0, it is better to compare it to epsilon > and avoid wonkiness from division by something too close to 0. > > BUG=chromium:702041 > > Change-Id: I8136d6063f8debd41cef37eaab7e4097b3f32f4b > Reviewed-on: https://pdfium-review.googlesource.com/3090 > Commit-Queue: Nicolás Peña <npm@chromium.org> > Reviewed-by: dsinclair <dsinclair@chromium.org> > TBR=tsepez@chromium.org,dsinclair@chromium.org,npm@chromium.org,pdfium-reviews@googlegroups.com # Not skipping CQ checks because original CL landed > 1 day ago. BUG=chromium:702041 Change-Id: Ia7d933fd3d8ce4957788341463866a04679d7f2b Reviewed-on: https://pdfium-review.googlesource.com/4432 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-21Fix Visual Studio build from GN generated filesDominik Röttsches
VS does not like to see <, > in the XML nodes of the build files. Work around this issue by replacing less-than and greater-than characters in the FreeType custom config include file path definitions with escaped quotes. BUG=pdfium:701 Change-Id: I879ade670158ccb4d435b65cde382c6e6b32e002 Reviewed-on: https://pdfium-review.googlesource.com/4330 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-21Replace FXSYS_iswdigit with std::iswdigit.Lei Zhang
Replace other one-off implementations as well. Change-Id: I2878f3fae479c12b7de5234ee3a26477d602d14d Reviewed-on: https://pdfium-review.googlesource.com/4398 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-21Change more fxbarcode to use return values.Lei Zhang
Change-Id: Idcc05fb8c5a1448f552b4db5ae131ad82aef4d59 Reviewed-on: https://pdfium-review.googlesource.com/4258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-20Remove hand-written bsearch from cfx_xmlsyntaxparser.cppchromium/3077Tom Sepez
Convert IsXMLNameChar() to static method for easier testing without namespace pollution. Change-Id: I004557e74fde94d3582b0a2326e5e68b907b9690 Reviewed-on: https://pdfium-review.googlesource.com/4397 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-20Remove hand-written bsearch from cxfa_dataexporter.cppTom Sepez
Binary search over an array of 5 elements is overkill. Change-Id: I3a39e82035d67564012c11aaf78045e435d59a41 Reviewed-on: https://pdfium-review.googlesource.com/4396 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-20Cleanup some XFA widget codeDan Sinclair
This CL cleans up the nits in some of the XFA widget files. Change-Id: If72e7855a09a22b2ec8ad3ce297b142ce35f71c9 Reviewed-on: https://pdfium-review.googlesource.com/4395 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-20Take ContainsValue() change from base stl_util.hTom Sepez
Allows us to apply this same predicate onto ordinary arrays. Change-Id: I917be09ed5e55167657c9af97f45f2ea2dbc6ab4 Reviewed-on: https://pdfium-review.googlesource.com/4270 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-20Let {Argb,Cmyk}Decode return tuplesNicolas Pena
Change-Id: Ic4e766d9417f9a9ece5f9e4269d0f96e1e91639b Reviewed-on: https://pdfium-review.googlesource.com/4392 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-20Revert "core: allow building against system zlib"dsinclair
This reverts commit 36c5b170e722362d4b5f7cb6e4e0099ed227a307. Reason for revert: This appears to be blocking the roll into Chromium. https://chromium-review.googlesource.com/c/476165/ Original change's description: > core: allow building against system zlib > > In a way similar to the existing USE_SYSTEM_LIBJPEG. The default is of > course still the DEPS-based zlib checkout. > > Change-Id: I649e75beb1a19c4cf7abda42fa10ebe5babfe946 > Reviewed-on: https://pdfium-review.googlesource.com/4070 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> > TBR=thestig@chromium.org,dsinclair@chromium.org,npm@chromium.org,vmiklos@collabora.co.uk,pdfium-reviews@googlegroups.com # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I1ee6fb002f444ff9b559ce6a69679e63de7ff9cc Reviewed-on: https://pdfium-review.googlesource.com/4393 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-20Convert IFX_MemoryStream to CFX_MemoryStreamDan Sinclair
The CFX_MemoryStream is the only implementation of IFX_MemoryStream. This CL removes the interfaces and uses CFX_MemoryStream directly. Change-Id: I2f43fa39e82dafa7673517d214ae15fd2d0df331 Reviewed-on: https://pdfium-review.googlesource.com/4391 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-20Do not insert null node if ParseAsXDPPacket_Config failsTom Sepez
Doing so trips an assert in the debug build but is harmless otherwise. This appears to be wrong since the beginning of time. Bug: 709793 Change-Id: I179f6944a3f7b2a89efa65a16078f6f58448ba4b Reviewed-on: https://pdfium-review.googlesource.com/4390 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-20Move fxcrt_stream code to fx_stream fileDan Sinclair
This Cl consolidates the stream code into fx_stream. Change-Id: I22a250b4ca6e342592b81260d2a918ebab7f60a2 Reviewed-on: https://pdfium-review.googlesource.com/4373 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-20Cleanup the fx_extension code.Dan Sinclair
This CL cleans up the fx_extension file. The stream code was moved to fx_stream. IFX_FileAccess was removed and CFX_CRTFileAccess split to its own file. Code shuffled from header to cpp file. Change-Id: I700fdfcc9797cf4e8050cd9ba010ad8854feefbf Reviewed-on: https://pdfium-review.googlesource.com/4371 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-20core: choosen -> chosenMiklos Vajna
Change-Id: I5b78fe4238a68bb6ba56aa76b53b315ef6f8574c Reviewed-on: https://pdfium-review.googlesource.com/3730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-20Remove the friends of CPDF_FormFieldNicolas Pena
Added some public methods so that CPDF_FormField has no friends. Change-Id: I179537e3c6ea64cedaca5365010c34c1ad702c40 Reviewed-on: https://pdfium-review.googlesource.com/4370 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-19Split up CFX_DIBitmap::ConvertColorScaleNicolas Pena
The code is completely separated into CMYK vs RGB cases, so having two separate private methods is better. Change-Id: I67f885ee2f4393b722c6d6e770b230a5aa6b0cb1 Reviewed-on: https://pdfium-review.googlesource.com/4372 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Wei Li <weili@chromium.org>
2017-04-19Update IFX_CharIter::Clone to return unique_ptrDan Sinclair
This Cl converts the Clone method of IFX_CharIter to return a unique_ptr. The usages were all converting to a unique_ptr already. Change-Id: I1ca5ddd03eca8f21d616efb2b92fb27899c43c23 Reviewed-on: https://pdfium-review.googlesource.com/4351 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-19Rename array names to match codepage namesDan Sinclair
Rename arrays to use code page names to make it clearer what they represent. Change-Id: Ia7d74353f6bae5fd7f030c05675664dafda03a7a Reviewed-on: https://pdfium-review.googlesource.com/4350 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>