summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2017-12-19Change pattern creation checks in CPDF_DocPageData::GetPattern().Lei Zhang
Do them in the right places, instead of having a catch-all at the end. Change-Id: Ie26f06dbd1c50d5b5bf57aa1f9993d5d19f74c02 Reviewed-on: https://pdfium-review.googlesource.com/21670 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
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-12Use early returns in pdf_parser_decode.cpp.Lei Zhang
Also add a GetUnicodeFromBytes() helper function and use FX_INVALID_OFFSET more often. Change-Id: I3b0954e0cad31a600b0a990360ab370186c792d6 Reviewed-on: https://pdfium-review.googlesource.com/20850 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@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-11Slightly simplify CPDF_StreamAcc::LoadAllData().Lei Zhang
Also initialize members in the header. Change-Id: Ic1cda7f9ef4c69e26604c706678aed24bf4e8ee3 Reviewed-on: https://pdfium-review.googlesource.com/20790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@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-08Fix build when using different sysroots.chromium/3289Andrew Weintraub
Bug: Change-Id: I86b4c72343288d83d51f493d3d888aad45baed5a Reviewed-on: https://pdfium-review.googlesource.com/20610 Reviewed-by: Lei Zhang <thestig@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-06Fix nits on some font code.Lei Zhang
Change-Id: I80be0de1a7d9ba502b4468bc13a4595566f8fb30 Reviewed-on: https://pdfium-review.googlesource.com/20432 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-05Replace uses of bsearch().chromium/3286Lei Zhang
Either switch to std::lower_bound(), or brute force when the search space is very small. Change-Id: I54db346aeb6f2e8000e95a6a9c8fbdd512df500a Reviewed-on: https://pdfium-review.googlesource.com/20431 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-05Replace bsearch() in FPDFAPI_CIDFromCharCode().Lei Zhang
Use std::lower_bound() instead. Change-Id: I0bed2a90f3aa427a283cd86a050a027ec7a64358 Reviewed-on: https://pdfium-review.googlesource.com/20430 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-05Remove redundant field in struct FXCMAP_CMap.Lei Zhang
Change-Id: Ibac6398b5849820562830bb8ed95c3428496f7ef Reviewed-on: https://pdfium-review.googlesource.com/20410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Add text unit to glyph unit conversion to CPDF_Type3Char.Lei Zhang
Use it in type 3 font code. Change-Id: I8b0eb462cc0308f1700d21a62efc929babae8e20 Reviewed-on: https://pdfium-review.googlesource.com/20215 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Fix nits in CPDF_Type3Font.Lei Zhang
Change-Id: Ib922184ee844e66a0b29f49025e83e13eb81fdb8 Reviewed-on: https://pdfium-review.googlesource.com/20214 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@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-01Remove unneded structs from CFX_CTTGSUBTable part 2Nicolas Pena
This CL continues removing structs from CFX_CTTGSUBTable Change-Id: I1ede1e3e736f87292b6119406fd5f12a0bb7e7cb Reviewed-on: https://pdfium-review.googlesource.com/20170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@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-30Fix GBK2K-H CMap usage.Lei Zhang
The data used is clearly a CID Range, but the code was interpreting it as single CID values. Change-Id: Ibb68f5ca2150d74b007a64ef5daa412fd542cecd Reviewed-on: https://pdfium-review.googlesource.com/17650 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-30Use initializer list in CPDF_DataAvail ctor.Lei Zhang
Or initialize members in the header. Also make m_dwFileLen member const. Change-Id: Iaaeab9a93e18e4ab313437362c0012d729b01647 Reviewed-on: https://pdfium-review.googlesource.com/9970 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-29Remove unneded structs from CFX_CTTGSUBTable part 1Nicolas Pena
This CL removes some useless structs from CFX_CTTGSUBTable. Change-Id: Iaf8b58d70b36d77fea73946c6b4279b15f5726e8 Reviewed-on: https://pdfium-review.googlesource.com/19710 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-27Remove CollectionSize from CPDF_RenderStatusDan Sinclair
Bug: pdfium:774 Change-Id: I4996f5526884c33d92df964045bd5467c392df5e Reviewed-on: https://pdfium-review.googlesource.com/19490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from CPDF_CharPosListDan Sinclair
Bug: pdfium:774 Change-Id: I7ebbcb17374b4117f92b94edbd8bcba18efe6313 Reviewed-on: https://pdfium-review.googlesource.com/19470 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from FPDF_DataDecodeDan Sinclair
Bug: pdfium:774 Change-Id: I3fcde6fba46d21affa63d79fab2d83f47c9c5f84 Reviewed-on: https://pdfium-review.googlesource.com/19450 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@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-27Remove use of CollectionSize from CPDF_CMapParserDan Sinclair
Bug: pdfium:774 Change-Id: Ie24d0741f8c8d7988166aeb4b9ce87491993d30c Reviewed-on: https://pdfium-review.googlesource.com/19390 Commit-Queue: dsinclair <dsinclair@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-22Remove some pointless assignments to "".Lei Zhang
Or change them to clear(). Change-Id: Ia9e3e1f0d74b948cec3f8df85d205f830ac9216c Reviewed-on: https://pdfium-review.googlesource.com/19172 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-16Convert ByteString::{Format|FormatV} to static methodsDan Sinclair
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-13Check first page number in IsLinearizedHeaderValid().Lei Zhang
This should allow https://pdfium-review.googlesource.com/15770 to safely reland. BUG=chromium:781529 Change-Id: Id0c1bde3280fb72125d8e74751b9a1cb35302b6f Reviewed-on: https://pdfium-review.googlesource.com/18170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-10Stop using m_SavedPage in embedder tests.chromium/3265Henrique Nakashima
Change-Id: Id53f57085fecfe331c8cbfa6bb372b5ea5044442 Reviewed-on: https://pdfium-review.googlesource.com/18332 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-11-08Make most CPDF_LinearizedHeader members const.chromium/3263Lei Zhang
Change-Id: I82907ad725861b9ccd6299f5dfe20ddb9d238178 Reviewed-on: https://pdfium-review.googlesource.com/17796 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-08Fix FPDF_SaveAsCopy for linearized PDFs.Henrique Nakashima
Only the last trailer was written to the new PDF. In linearized PDFs, this means Info and Root were not copied to the newly written PDF. This CL makes CPDF_Parser remember the Root and provide that to CPDF_Creator. Bug: pdfium:614 Change-Id: Ia61f5f6a337f7de3010ee0ed39b022c1b2732ea2 Reviewed-on: https://pdfium-review.googlesource.com/17987 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@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-07Remove m_bFlagExact from CFX_SubstFontNicolas Pena
This CL removes the single use case from |m_bFlagExact|. This flag allows the PDF viewer to treat a substitute font with a matching name as if it was actually an embedded font, which is wrong. For all substitute fonts, it is important to follow the longer process of first obtaining the unicode from the charcode to then obtain the glyph in the substitute font that corresponds to that unicode. Bug: chromium:781785 Change-Id: Ie5958b43914e0e46334b89b7c2c55c02d0da0c11 Reviewed-on: https://pdfium-review.googlesource.com/17859 Reviewed-by: Lei Zhang <thestig@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-06Revert "Simplify CPDF_HintsTable."dsinclair
This reverts commit 33591752d2cb14f2e07726ca52afce6efbdc07c9. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=781529 Original change's description: > Simplify CPDF_HintsTable. > > Use CPDF_LinearizedHeader directly. > > Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa > Reviewed-on: https://pdfium-review.googlesource.com/15770 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Idaf8d4c91e869d92b44211cfe48f162037ed7327 Reviewed-on: https://pdfium-review.googlesource.com/17830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-06Pack struct FXCMAP_CMap more densely to save 1 KB.Lei Zhang
Change-Id: Ida9738f4ad7ef266c2edb794f12dcf49b64fc590 Reviewed-on: https://pdfium-review.googlesource.com/17750 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@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-04Simplify CPDF_HintsTable.Artem Strygin
Use CPDF_LinearizedHeader directly. Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa Reviewed-on: https://pdfium-review.googlesource.com/15770 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@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-03Simplify CPDF_SecurityHandler.Lei Zhang
Remove unused method params, impossible code, and mark methods const. Change-Id: Iee95c7b931461e2aadcf2422650a0cd48c8f7696 Reviewed-on: https://pdfium-review.googlesource.com/17790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>