summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
AgeCommit message (Collapse)Author
2017-12-16Fix null-dereference in CPDF_ShadingPattern::Load().chromium/3298chromium/3297Lei Zhang
BUG=chromium:795490 TBR=hnakashima@chromium.org Change-Id: Ic9f12c1c709c148f7294ab2aaf65fcc695960835 Reviewed-on: https://pdfium-review.googlesource.com/21530 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-15Validate base color space of Indexed color spaces.chromium/3296Henrique Nakashima
Change-Id: I2c1dbf4fe08396130d2fcecd70e175233316579b Reviewed-on: https://pdfium-review.googlesource.com/21430 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-15Validate shading pattern's ColorSpace. It cannot be a Pattern CS.Henrique Nakashima
Bug: chromium:795251 Change-Id: I6c4fd75a5afd16ced499d031f9b535f8c6828854 Reviewed-on: https://pdfium-review.googlesource.com/21410 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-14Add restrictions to alternate color spaces.chromium/3295Henrique Nakashima
- ICC color spaces cannot have a Pattern color space as Alternate - Separation and DeviceN color spaces cannot have a special color space as Alternate. Special color spaces are {Separation, DeviceN, Indexed and Pattern}. Bug: chromium:794492 Change-Id: Ia2199382c759d8d1d13c605c22d6495e935265ad Reviewed-on: https://pdfium-review.googlesource.com/21310 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-11Remove default arguments to CPDF_StreamAcc::LoadAllData().Lei Zhang
Add LoadAllDataFiltered() and LoadAllDataRaw() and update callers. Change-Id: I9b80ee34a358db204968acdc8b1adc9db0b6b83f Reviewed-on: https://pdfium-review.googlesource.com/20810 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-11Move some GetDict() calls out of header files.Lei Zhang
Change-Id: I13b297ddb080b478a30a959889941b46feb363b3 Reviewed-on: https://pdfium-review.googlesource.com/20770 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-06Move m_CharCodes to local for crash investigationBruce Dawson
m_CharCodes is getting corrupted and it's difficult to tell why. This moves it to a local variable before it is destroyed so that the corruption - which should be copied over - will be stored in the crash dump. Bug: 782215 Change-Id: Ifd09b21396bf28bca69f2b4082c61cbc4782e209 Reviewed-on: https://pdfium-review.googlesource.com/20530 Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Encapsulate CPDF_Type3Char members.Lei Zhang
Change-Id: Iec4e999d76dabc9b6cd00323881c5c87afc5f629 Reviewed-on: https://pdfium-review.googlesource.com/19930 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-27Convert CPDF_TextObject to not use CollectionSizeDan Sinclair
This CL updates various methods in CPDF_TextObject to return or received size_t values. Callers have been updated as needed. Bug: pdfium:774 Change-Id: Id72511bc74637c6261add39f5414c9a4b8390b82 Reviewed-on: https://pdfium-review.googlesource.com/19430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Convert CPDF_ClipPath::Get{Path|Text}Count to size_tDan Sinclair
This CL updates the various call sites to use size_t instead of other types. Bug: pdfium:774 Change-Id: Id8b75728b61c0ca1b15bc815831c885d33374f7b Reviewed-on: https://pdfium-review.googlesource.com/19410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-22Change CPDF_ContentMark to return size_t for counts.Lei Zhang
Change-Id: I45468fa7944290fbbe3d2e67f884164ae8d84160 Reviewed-on: https://pdfium-review.googlesource.com/19171 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove dead CPDF_ContentMark code.Lei Zhang
Change-Id: Ic552a652856ca231f3d2077c76a20d5916adb3c1 Reviewed-on: https://pdfium-review.googlesource.com/19170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Avoid passing pointers by reference in core.Lei Zhang
This gets rid of most core/ non-const ref passing, either by passing by pointer-to-pointer instead, or by returning std::pair. Change-Id: Id7bdc355a1a725a05f9fa2f1e982ca8c975beef1 Reviewed-on: https://pdfium-review.googlesource.com/19030 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-08Use MaybeOwned in CPDF_ContentParserNicolas Pena
Change-Id: I7e5daeafd70ef29bcc9bdebbae004fa4b946b83d Reviewed-on: https://pdfium-review.googlesource.com/18019 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Simplify CPDF_ContentParser.Lei Zhang
Do more work in the ctor instead of a separate Start() method. Adjust callers and member variables accordingly. Change-Id: I310f27b3102a89e8e7b7ad31affd174f1fbbe500 Reviewed-on: https://pdfium-review.googlesource.com/17793 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Change CPDF_PSProc::AddOperator() to do binary search.Lei Zhang
Change-Id: If64a8410c992d5c7bd6504367f11ce946c1ef6aa Reviewed-on: https://pdfium-review.googlesource.com/17871 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-06Add a CPDF_PSEngine test.Lei Zhang
Change-Id: Ia267f40dc4ebe9e1d28b6a333eddcff749414ffa Reviewed-on: https://pdfium-review.googlesource.com/17870 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Remove C-style casts in CPDF_PSEngine.Lei Zhang
Fix a few other nits. Change-Id: I12f79b3f83d1695957ba067291f2ee03a7d189ca Reviewed-on: https://pdfium-review.googlesource.com/17810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Mark some CPDF_StreamContentParser members as const.Lei Zhang
Change-Id: I6c4ee5400307c8321f2558287f4d7571c373fcaa Reviewed-on: https://pdfium-review.googlesource.com/17795 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-03Remove C-style casts in cpdf_colorspace.cpp.Lei Zhang
Change-Id: Icce0751713dc39d2b3f3c3f23f7ed45df3d4952f Reviewed-on: https://pdfium-review.googlesource.com/17771 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03The component count in CPDF_IndexedCS should be unsigned.Lei Zhang
Since the source of the component count is unsigned. Adjust related variables to also be unsigned. In CPDF_IndexedCS::GetRGB(), switch integer overflow code to use FX_SAFE_SIZE_T, and write to the out params correctly on failure. Change-Id: If7405b4c5e9022ba1992fff2be2bcc1a7826adf4 Reviewed-on: https://pdfium-review.googlesource.com/17770 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Encapsulate CPDF_FormObject members.Lei Zhang
Also remove a conditional in the CPDF_Form ctor that cannot be true. Change-Id: Icd00233969cea33e9c63d0d6a9d07226c2b173f2 Reviewed-on: https://pdfium-review.googlesource.com/17070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Rename Transparency to iTransparency.Lei Zhang
Fix a mismatched parameter name in cpdf_renderstatus.h too. Change-Id: I9765838e6ab93db37791fc282e553b6cb9c51ec5 Reviewed-on: https://pdfium-review.googlesource.com/17050 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-10-17Fix loading mutually referencing colorspaces.chromium/3243Henrique Nakashima
CPDF_DeviceNCS and CPDF_SeparationCS can load other colorspaces and their v_Load() needs to pass around a set of visited spaces to avoid stack overflows if that other colorspace references the first one. Bug: chromium:773095 Change-Id: Idae26c95a8034c3ded70f70e20ae1c414d7b29c3 Reviewed-on: https://pdfium-review.googlesource.com/16250 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-04Remove friends from CPDF_TextObjectchromium/3233Dan Sinclair
This CL removes the friends from CPDF_TextObject and adds accessor methods as needed. Change-Id: I68d18297640b46113df79f58bea50b77dac89d39 Reviewed-on: https://pdfium-review.googlesource.com/15455 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Make CPDF_TransferFunc members privateDan Sinclair
This CL moves the member variables of CPDF_TransferFunc to be private from public and adds accessors as needed. Change-Id: Ib5158721bbe833727b333da794d774f17e4fdea7 Reviewed-on: https://pdfium-review.googlesource.com/15451 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-27Remove FX_STRSIZE and replace with size_tRyan Harrison
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-21Move CFX_WeakPtr to WeakPtrDan Sinclair
This CL renames CFX_WeakPtr to WeakPtr and moves into the fxcrt namespace. Bug: pdfium:898 Change-Id: Ide50a8afeb1e987c48c8fbd103898745c9199d6a Reviewed-on: https://pdfium-review.googlesource.com/14621 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Move CFX_UnownedPtr to UnownedPtrDan Sinclair
This CL moves CFX_UnownedPtr to UnownedPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I6d1fa463f365e5cb3aafa8c8a7a5f7eff62ed8e0 Reviewed-on: https://pdfium-review.googlesource.com/14620 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_StringPoolTemplate to StringPoolTemplateDan Sinclair
This CL moves CFX_StringPoolTemplate to StringPoolTemplate and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I41c8f23d6ad814d65cd154092143efaa630a96d1 Reviewed-on: https://pdfium-review.googlesource.com/14619 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_SharedCopyOnWrite to SharedCopyOnWriteDan Sinclair
This CL renames CFX_SharedCopyOnWrite to SharedCopyOnWrite and moves to the fxcrt namespace. Bug: pdfium:898 Change-Id: Iced796b9f341407720e2a88f11d1916df56fe68c Reviewed-on: https://pdfium-review.googlesource.com/14617 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Rename CFX_RetainPtr to RetainPtrDan Sinclair
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_MaybeOwned to fxcrt::MaybeOwnedDan Sinclair
This CL moves CFX_MaybeOwned into the fxcrt namespace and removes the CFX_ prefix. The test names for maybe owned were updated to be in the MaybeOned test suite instead of the fxcrt suite. Bug: pdfium:898 Change-Id: I0c07057d66c8610e7b19133094b4507fff725e76 Reviewed-on: https://pdfium-review.googlesource.com/14470 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-20Isolate lcms2 usage to a few files.Lei Zhang
Then set up the right dependencies for them. BUG=chromium:765914 Change-Id: I036cd888c741927d5efe0d020c6676f169e7cbb1 Reviewed-on: https://pdfium-review.googlesource.com/14410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-20Forward declare codec modules in fx_codec.h.Lei Zhang
Change-Id: I020b862619f3f93f71dbb027b9e799d78744f686 Reviewed-on: https://pdfium-review.googlesource.com/14391 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-20Move CCodec_ScanlineDecoder to its own file.Lei Zhang
Change-Id: Icacf877e2b66ca7d49637dcf9eaec0f99bcdd8bb Reviewed-on: https://pdfium-review.googlesource.com/14390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-19Remove unneeded core/fxcodec/fx_codec.h includes.chromium/3220Lei Zhang
Change-Id: I703321108712e8c4a11a8343ecf8b1a8804c1d1a Reviewed-on: https://pdfium-review.googlesource.com/14352 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-13Change behaviour of FPDF_RenderPageBitmapWithMatrixNicolas Pena
This CL changes the behavior of FPDF_RenderPageBitmapWithMatrix so it transforms the bitmap. Before, the page would be transformed and the assumption was that it would be drawn on a bitmap with the same dimensions as the original page. This does not work well because a transformation generally changes the dimensions of the page. The rectangles test is modified to include small rectangles in the corner of the page, so that it's clear that the whole original page is being displayed. Bug: pdfium:849 Change-Id: Ie89f959a1605fea59a15d239ca871ccd939ec92b Reviewed-on: https://pdfium-review.googlesource.com/13510 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-08-31Fix colorspace loading for mutually referencing colorspaces.Henrique Nakashima
For example, Indexed colorspace A uses ICC Based colorspace B as its "base". B declares A as its "Alternate" fallback. Bug: chromium:759012 Change-Id: I4b78e68b9a77456050ecae4452837495546bf93d Reviewed-on: https://pdfium-review.googlesource.com/12471 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-08-31Remove fx_basic.hDan Sinclair
This CL removes the fx_basic.h header and fixes up includes as needed. Change-Id: I49af32a8327bdbcda40c50a61ffbd75d06609040 Reviewed-on: https://pdfium-review.googlesource.com/12670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Prevent duplicate parses of same data, in the same recursive descentRyan Harrison
When parsing if there is a loop in the data being parsed, the recursions will just keep cycling until it exhausts memory and crashes. This CL introduces a parsed set, which a reference to is passed down the descent. If the data being parsed at a specific stage of the descent is already in the parsed set, then the parse returns at that point. BUG=chromium:759224 Change-Id: I1dca73d81020099dec03fd49aaa44cdcdf38e17e Reviewed-on: https://pdfium-review.googlesource.com/12470 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-31Change CPDF_Form::ParseContent() to ParseContentWithParams().Lei Zhang
Add a new ParseContent() method as a convenience to call ParseContentWithParams() with the default parameters. Change-Id: I274682845a72e125c3fc6299289edb760104ac4d Reviewed-on: https://pdfium-review.googlesource.com/12250 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-08-31Split IFX_Pause out of fx_basicDan Sinclair
This CL moves IFX_Pause out to its own class from fx_basic and updates includes as needed. Change-Id: Iebdd183d8c85aa17570f190f1a7d1602c0af3c8b Reviewed-on: https://pdfium-review.googlesource.com/12491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Split CFX_FixedBufGrow out of fx_basicchromium/3201Dan Sinclair
This CL moves CFX_FixedBufGrow to its own files and updates includes as needed. Change-Id: Ia0cb70569b30acdb3ba9f23d8937ab8f9c17d6e6 Reviewed-on: https://pdfium-review.googlesource.com/12490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Move CFX_BitStream to its own fileDan Sinclair
This CL moves the CFX_BitStream code out of fx_basic and into cfx_bitstream. Bug: pdfium:867 Change-Id: I5b7e6190a7db1fe1d24feb6bd676035a5c73ee92 Reviewed-on: https://pdfium-review.googlesource.com/12350 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Convert int* references to FX_STRSIZERyan Harrison
Through out the code base there are numerous places where variables are declared using a signed integer type when interacting with the string classes, since they assume that FX_STRSIZE is 'int'. As part of changing the underling type of FX_STRSIZE to be unsigned, these locations are being changed to use FX_STRSIZE. This is necessary as part of converting the type, but has been broken off into a separate CL, since it should be low risk. Some related cleanups that are low risk are included as part of this CL. BUG=pdfium:828 Change-Id: Ifaae54ad195ccde0fe8672f71271d29a6ebd65fd Reviewed-on: https://pdfium-review.googlesource.com/12210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-29Make some CPDF_StreamContentParser methods static.Lei Zhang
For methods that are only exposed for testing. Once they are static, there is no need for dummy CPDF_StreamContentParser constructor calls in the unit tests. Adjust the CPDF_StreamContentParser constructor now that one of the parameters can no longer be a nullptr. Change-Id: If29b02ea216002a7bb325b1913281f58b70382aa Reviewed-on: https://pdfium-review.googlesource.com/12230 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-23Convert string Find methods to return an OptionalRyan Harrison
The Find and ReverseFind methods for WideString, WideStringC, ByteString, and ByteStringC have been converted from returning a raw FX_STRSIZE, to returning Optional<FX_STRSIZE>, so that success/failure can be indicated without using FX_STRNPOS. This allows for removing FX_STRNPOS and by association makes the conversion of FX_STRSIZE to size_t easier, since it forces checking the return value of Find to be explictly done as well as taking the error value out of the range of FX_STRSIZE. New Contains methods have been added for cases where the success or failure is all the call site to Find cared about, and the actual position was ignored. BUG=pdfium:828 Change-Id: Id827e508c8660affa68cc08a13d96121369364b7 Reviewed-on: https://pdfium-review.googlesource.com/11350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>