summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2018-09-19Consolidate raw data processing path in CPDF_StreamAcc.Lei Zhang
Add ProcessRawData() and ProcessFilteredData() helper methods for the consolidated branches. Change-Id: I88fb0ffb76e5d354bc311490a9d995e07fbc2174 Reviewed-on: https://pdfium-review.googlesource.com/42593 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-19Initialize CPDF_ImageRenderer in the header.Lei Zhang
Also add a GetRenderOptions() helper method. Change-Id: I47db7a21f55f396e08775575f6b2a48e440c2f91 Reviewed-on: https://pdfium-review.googlesource.com/42750 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-19Encapsulate CPDF_ImageLoader.Lei Zhang
Change-Id: Iee7ce04630fed86f651cd382a19e46b2f7ab6d61 Reviewed-on: https://pdfium-review.googlesource.com/42672 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-19Validate decoder pipelines.Lei Zhang
PDF decoders, AKA filters, can be chained together. There can be an arbitrary number of decoding / decompressing filters in the pipeline, but there should be at most 1 image decoder, and the image decoder should only be at the end of the chain. BUG=chromium:880675 Change-Id: Iffa27c70ec1ed7574e38e0de23413840ee900959 Reviewed-on: https://pdfium-review.googlesource.com/42711 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-18Encode mark names when writing to file.Henrique Nakashima
Bug: pdfium:1150 Change-Id: I7e589fb3d164dfc9b39a7a3f6e782c09331cc32d Reviewed-on: https://pdfium-review.googlesource.com/42630 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-17Check for empty streams earlier in CPDF_StreamAcc::LoadAllData().Lei Zhang
Change-Id: I91c8d7d837e4c2104d56d725c16a28d49399aaca Reviewed-on: https://pdfium-review.googlesource.com/42592 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-17Extract duplicate code into GetShadingSteps().Lei Zhang
Change-Id: I6761a5f7fc099807c09abacdccbb72d282252551 Reviewed-on: https://pdfium-review.googlesource.com/42604 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-17Remove CPDF_StreamAcc::m_pSrcData.Lei Zhang
It just ends up being a nullptr, so it is not useful. Change-Id: I52fcbb261c4bb0bc024e1856da95028431d577c1 Reviewed-on: https://pdfium-review.googlesource.com/42591 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-17Fix final/protected conflicts.Tom Sepez
Classes marked |final| should not have |protected| members. In turn, "private field m_dwEncryptObjNum is not used" warning is produced. Change-Id: I51a96aca5a5f499381a6764d892962f7f2dc0327 Reviewed-on: https://pdfium-review.googlesource.com/42611 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-17Encapsulate CPDF_StreamAcc::LoadAllData().Lei Zhang
Make it a private method, and add public methods so only limited combinations of LoadAllData() arguments are possible. Change-Id: I8c2220eb0e95012350858876586f7c470c40a7c3 Reviewed-on: https://pdfium-review.googlesource.com/42590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-14Add CPDF_Document::StockFontClearer.Lei Zhang
So CPDF_Document's dtor does not have to do any explicit cleanup. Change-Id: Iaec7d18f67422914542fc1dc5f3b1b5a9cf5ffc5 Reviewed-on: https://pdfium-review.googlesource.com/42551 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-14Use UnownedPtr in CFX_UnicodeEncoding.Lei Zhang
Change-Id: I410909be359a5b5bb0c90d42064144771183525e Reviewed-on: https://pdfium-review.googlesource.com/42461 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-14Make ContentParam::m_Name be a ByteString.Tom Sepez
Currently this is an inline fixed-length char[] buffer. We make a byte string out of this in many places, and the current implementation still memcpy's, so the additional costs should be minimal. Next, we can avoid special-casing names that are longer than the fixed size. Change-Id: I980463cbb2325a9d6080bb51a6dfb0dbd1b704b1 Reviewed-on: https://pdfium-review.googlesource.com/42430 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-13Reland "Introduce FX_Number class as a replacement for FX_atonum()."Tom Sepez
This reverts commit 29e180342e18873babf1c74f7c5c056f90a191b0. Reason for revert: probably harmless Original change's description: > Revert "Introduce FX_Number class as a replacement for FX_atonum()." > > This reverts commit a5d7ad3aa8feb08a14b5cca173d673054c1ade23. > > Reason for revert: Speculative revert to get back before flake. > > Original change's description: > > Introduce FX_Number class as a replacement for FX_atonum(). > > > > The issue with FX_atonum() is that it doesn't return any information > > about whether it range-checked its integer values as a signed or > > unsigned type, even though it knows this as part of its processing. > > > > Rather than adding another out parameter to that function, create > > a class to hold all this information together. > > > > This is the first place things went astray while diagnosing > > bug 882959, in that a large positive value was cast to float as a > > negative value. Unfortunately, this doesn't affect the related bug, > > but is a step in the right direction. > > > > Change-Id: I0977ec8fccf85e2632a962507bdd30a1cbe6d33c > > Reviewed-on: https://pdfium-review.googlesource.com/42353 > > Reviewed-by: Lei Zhang <thestig@chromium.org> > > Commit-Queue: Tom Sepez <tsepez@chromium.org> > > TBR=thestig@chromium.org,tsepez@chromium.org > > Change-Id: Ia56270c3daa80408fc2b23eb4384a77f03f45b82 > Reviewed-on: https://pdfium-review.googlesource.com/42392 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org Change-Id: I83c37aa3040a8890f2117753f19ab1d452d411e7 Reviewed-on: https://pdfium-review.googlesource.com/42410 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-13Reland "Make things more const-y"chromium/3552Tom Sepez
This reverts commit 5700d9e2eea5813861920995815ac092fd7df973. Reason for revert: Harmless, I think. Original change's description: > Revert "Make things more const-y" > > This reverts commit 882ed81dec7afc5bc106f965af34f1e59407fd95. > > Reason for revert: Rule out that this be making embeddertest flakey. > Seems improbable, but maybe the const is allowing the compiler to use stale data in a non-logically const operation ??? > > Original change's description: > > Make things more const-y > > > > Follow up to https://pdfium-review.googlesource.com/c/pdfium/+/42350 > > to use const more in the changed code. > > > > BUG=chromium:881678 > > > > Change-Id: I7a88862952c9ba25ffa89c2827e1de322f3b5c33 > > Reviewed-on: https://pdfium-review.googlesource.com/42370 > > Commit-Queue: Ryan Harrison <rharrison@chromium.org> > > Reviewed-by: Lei Zhang <thestig@chromium.org> > > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > > TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org > > Change-Id: Ifee656f151d3e6dab6de33c3b96b37b9809004c4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:881678 > Reviewed-on: https://pdfium-review.googlesource.com/42372 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I24de62969b039288596aa4d0b268ad49728e4891 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:881678 Reviewed-on: https://pdfium-review.googlesource.com/42393 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-13Revert "Introduce FX_Number class as a replacement for FX_atonum()."Tom Sepez
This reverts commit a5d7ad3aa8feb08a14b5cca173d673054c1ade23. Reason for revert: Speculative revert to get back before flake. Original change's description: > Introduce FX_Number class as a replacement for FX_atonum(). > > The issue with FX_atonum() is that it doesn't return any information > about whether it range-checked its integer values as a signed or > unsigned type, even though it knows this as part of its processing. > > Rather than adding another out parameter to that function, create > a class to hold all this information together. > > This is the first place things went astray while diagnosing > bug 882959, in that a large positive value was cast to float as a > negative value. Unfortunately, this doesn't affect the related bug, > but is a step in the right direction. > > Change-Id: I0977ec8fccf85e2632a962507bdd30a1cbe6d33c > Reviewed-on: https://pdfium-review.googlesource.com/42353 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org Change-Id: Ia56270c3daa80408fc2b23eb4384a77f03f45b82 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/42392 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-13Revert "Make things more const-y"Tom Sepez
This reverts commit 882ed81dec7afc5bc106f965af34f1e59407fd95. Reason for revert: Rule out that this be making embeddertest flakey. Seems improbable, but maybe the const is allowing the compiler to use stale data in a non-logically const operation ??? Original change's description: > Make things more const-y > > Follow up to https://pdfium-review.googlesource.com/c/pdfium/+/42350 > to use const more in the changed code. > > BUG=chromium:881678 > > Change-Id: I7a88862952c9ba25ffa89c2827e1de322f3b5c33 > Reviewed-on: https://pdfium-review.googlesource.com/42370 > Commit-Queue: Ryan Harrison <rharrison@chromium.org> > Reviewed-by: Lei Zhang <thestig@chromium.org> > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: Ifee656f151d3e6dab6de33c3b96b37b9809004c4 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:881678 Reviewed-on: https://pdfium-review.googlesource.com/42372 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-13Make things more const-yRyan Harrison
Follow up to https://pdfium-review.googlesource.com/c/pdfium/+/42350 to use const more in the changed code. BUG=chromium:881678 Change-Id: I7a88862952c9ba25ffa89c2827e1de322f3b5c33 Reviewed-on: https://pdfium-review.googlesource.com/42370 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-09-13Introduce FX_Number class as a replacement for FX_atonum().Tom Sepez
The issue with FX_atonum() is that it doesn't return any information about whether it range-checked its integer values as a signed or unsigned type, even though it knows this as part of its processing. Rather than adding another out parameter to that function, create a class to hold all this information together. This is the first place things went astray while diagnosing bug 882959, in that a large positive value was cast to float as a negative value. Unfortunately, this doesn't affect the related bug, but is a step in the right direction. Change-Id: I0977ec8fccf85e2632a962507bdd30a1cbe6d33c Reviewed-on: https://pdfium-review.googlesource.com/42353 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-12Optimize CPDF_CMapParserRyan Harrison
In this parser, a vector of CodeRange values are built up during operations that need to be sync'd with the CPDF_CMap that is being initialized. In the existing implementation, the vector being built as a member var for the parser, and copying the values over to the cmap whenever there is a change. When profiling, this copy is where the code spends most of its time. The code has been rewritten to have the parser reference/modify the instance of the vector in the cmap instead of having its own copy. This removes all of the copies and significantly speeds things up. BUG=chromium:881678 Change-Id: Ib8e75962507ca3d3b1ed066fd1faa4fbb7141122 Reviewed-on: https://pdfium-review.googlesource.com/42350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-09-12Set correct stream index when parsing is done in several steps.Henrique Nakashima
When parsing happens in several steps (in pages with > 100 page objects), the position is reset to 0 and the start pointer is advanced. This breaks the calculation of which stream an object belongs to. Passing in the base pointer separately from the start offset allows the correct position to be calculated and the correct stream to be identified. Change-Id: Ic0d5f59f437609158aa97b3c8a18dbd48cd3b0d4 Reviewed-on: https://pdfium-review.googlesource.com/42270 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-11Do not copy data in DecodeAllScanlines().Lei Zhang
The copy will never be read. Change-Id: I129859ed7569e054e66f00314f8ecf20e2c67715 Reviewed-on: https://pdfium-review.googlesource.com/41854 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-11Make flate decode functions' buffer out parameter unique_ptrs.Lei Zhang
Change-Id: Idb14846e87a8287dd911b0a2f7a32146e86c2af7 Reviewed-on: https://pdfium-review.googlesource.com/41853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-11Make RunLengthDecode()'s buffer out parameter a unique_ptr.Lei Zhang
Change-Id: I1dc99831a564e88035c317455411f1eba9aa41c4 Reviewed-on: https://pdfium-review.googlesource.com/41852 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-11Make HexDecode()'s buffer out parameter a unique_ptr.Lei Zhang
Do the same for A85Decode(). Change-Id: Ic6a0e5e8a63defa104e35e97eb9ce4223aac23a7 Reviewed-on: https://pdfium-review.googlesource.com/41851 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-06Fix integer overflow in LoadCryptInfo.Henrique Nakashima
Bug: 847283 Change-Id: I7951103a5a425407b5375460a5556e8765430740 Reviewed-on: https://pdfium-review.googlesource.com/42090 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-04Fix some more span/memcpy interactions.Tom Sepez
Use the preferred idiom of creating a subspan, which makes the proper checks prior to the copy. Change-Id: Ia7f25b5760dea5707df66cf421195b23a1ce0ad0 Reviewed-on: https://pdfium-review.googlesource.com/41911 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-04Avoid CHECK in fpdf_parser_decode.cpp (memcpy empty span)Tom Sepez
Given a span of size N, memcpy(dest, &span[N], 0) ought to be a no-op, but since we compute span[N] before checking for zero length, we hit an assert. The correct idiom should be to create a sub-span, which allows specifying N, but only when the size is 0. Bug: 879910 Change-Id: Ic6f368109a5c2f1e13a5f638c6a233769e2ad41b Reviewed-on: https://pdfium-review.googlesource.com/41930 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-04Remove unneeded fpdf_parser_decode.h #includes.Lei Zhang
Change-Id: I2c52828c25b4941669503328517c12a0a1dd770e Reviewed-on: https://pdfium-review.googlesource.com/41850 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-31Simplify radial shading.Henrique Nakashima
Change-Id: I3b6a386cf376a418ad64514313c791437ea54cf6 Reviewed-on: https://pdfium-review.googlesource.com/41610 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-31Fix radial shading when start circle is a point in the center of end circle.Henrique Nakashima
The bug also requires end circle to be tiny (radius of < 0.01). Bug: pdfium:1140 Change-Id: I2b355f44f0383334b8988fe41f82cb3f587e9909 Reviewed-on: https://pdfium-review.googlesource.com/41672 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-29Use pdfium::span<>/UnownedPtr in CFX_Font.Tom Sepez
Move some platform-specific ifdefs so the come last in each section as it is easier to read, perhaps. Change-Id: Ic1c2652c46ecebc63b66213735ed6d94737a7f32 Reviewed-on: https://pdfium-review.googlesource.com/41630 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-29Fix radial shading when center of start point is on the border of an end circle.Henrique Nakashima
Radial shading is done between two circles with their own centers and radii. When one has a radius of 0 and is located on or very close to the border of the other circle, a should be 0, but is not due to rounding errors unless the circles are aligned in x or y. Bug: pdfium:1140 Change-Id: Ief2efa91f3f16f7bed439aa471b258fa4d680acf Reviewed-on: https://pdfium-review.googlesource.com/41590 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-29Use pdfium::span<> in fpdf_parser_decode.h helper functions.Tom Sepez
Change-Id: Ib0a2bd21fe4304163cf9c080e07475e7c033c299 Reviewed-on: https://pdfium-review.googlesource.com/41570 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-29Remove FPDFAPI_ prefix from internal cid/encoder functionsTom Sepez
These look too much like public/ FPDF functions otherwise and yet they are not exposed anywhere beyond core/fpdfapi. Disambiguate one method vs. top-level function usage as a result. Bug: pdfium:1141 Change-Id: I9cfdfced90386bb9ef6b2b86f568f2e6f8ee6a5a Reviewed-on: https://pdfium-review.googlesource.com/41530 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Use pdfium::span<> in more image modulesTom Sepez
Change-Id: Ie344bb37abf7dde158d03cc2897dca3588f1a5e3 Reviewed-on: https://pdfium-review.googlesource.com/41550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-28Use std::span<> in CCodec_JPEGModuleTom Sepez
Also rename .cpp file to match class name and .h file. Modify some helper functions to operate on spans. Move some initializations to member declarations. Change-Id: Ie0889bda91daaef80fae6f5681f8ce068e92453b Reviewed-on: https://pdfium-review.googlesource.com/41534 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-27Use pdfium::span<> in CCodec_RLScanlineDecoderTom Sepez
Change-Id: I3dc2dd54d89858722c2aea4b9e694308796b8274 Reviewed-on: https://pdfium-review.googlesource.com/41510 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Rename CFX_DIBSource to CFX_DIBBase.Tom Sepez
It is not a source from which you can get CFX_DIBs, but rather a base class from which all DIBs inherit. Do the same thing for the CPDF_DIBSource wrapper class. Mechanical change apart from adding a one-line comment in cfx_dibbase.h Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184 Reviewed-on: https://pdfium-review.googlesource.com/41352 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Use pdfium::span<> in CPDF_Stream::SetData().Tom Sepez
Conversion to span makes this more elegant in a number of places, owing to std::vector directly converting to span, and the bytestring's ToRawSpan(). Disambiguate single-argument forms to allow passing {} as an argument. Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2 Reviewed-on: https://pdfium-review.googlesource.com/41272 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Pass unique_ptr<> to CFX_MemoryStream constructorTom Sepez
Proves we own the memory that the class will eventually free. Change-Id: Ie9523da8db738e7478a1c73e3e1a6b24aed38442 Reviewed-on: https://pdfium-review.googlesource.com/41290 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fix GCC build with V8 disabled.Lei Zhang
- Remove set, but otherwise unused variables. - Mark some pdfium_test code as V8-enabled only. - Do not build one unit test with GCC. Change-Id: I3f04273a7731086e08386478a62769bf06f6d8a4 Reviewed-on: https://pdfium-review.googlesource.com/41271 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-23Fix shadowed variablesRyan Harrison
This CL fixes instances of variable shadowing that are discovered by turning on -Wshadow. BUG=pdfium:1137 Change-Id: I418d50de89ecbeb12e85b23a358bc61e8f16e888 Reviewed-on: https://pdfium-review.googlesource.com/41150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-08-23Remove bool bPromptCJK argument (several places)Tom Sepez
It gets computed, and passed around, but in the end no decisions are made because of it. Change-Id: If67f6f0cd0c37e52993832be1fb83498fd851914 Reviewed-on: https://pdfium-review.googlesource.com/41190 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fold CPDF_Document::LoadDocInternal() into caller.Tom Sepez
It is only called in one place. It also has a superfluous test and return as it is currently written introduced in https://pdfium-review.googlesource.com/c/pdfium/+/35490 Change-Id: Iba1aaac6e93c261f71729f39e51741f19c5dbb57 Reviewed-on: https://pdfium-review.googlesource.com/41071 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-22Properly handle language markers in decoded textRyan Harrison
In text like document title 0x001B is used as a marker for the beginning/end of a language metadata section. Currently PDFium does nothing with this data, but when returning the 'decoded' text it needs to be stripped out. The existing code assumed that the two bytes following a marker would be the data to be removed and did nothing to track if it was in/out of one of these regions. This led to a situation where it would always strip the two bytes following the region, since it assumed the end marker was the beginning of a new region. This CL corrects the detection and handling of these regions, and adds a regression test for the reported bug. BUG=pdfium:182 Change-Id: I92ddba5666274a8986fed03f502a0331f150f7ac Reviewed-on: https://pdfium-review.googlesource.com/41070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-22Fix integer overflow in CPDF_CIDFont::GetCharBBoxNicolas Pena
Bug: chromium:875924 Change-Id: I85c86d3f90ee62b5593b0b20e44283c5056702ff Reviewed-on: https://pdfium-review.googlesource.com/40730 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-08-20Use UnownedPtr<> in CPDF_ObjectWalker.Tom Sepez
Change-Id: I99eed369f4d44f92607a0a58ba24e8b62ee348f7 Reviewed-on: https://pdfium-review.googlesource.com/40671 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-17Use more UnownedPtr<> in cpdf_renderstatus.h.chromium/3526Tom Sepez
This immediately flags a case where a pointer from a heap object to a caller's stack object is persisted past the caller's lifetime. Fix it the simplest way via AutoRestorer<> so we'll get a nice safe segv should it be used. Change-Id: I554304b235e73c279fa0cd79c9e3ee0138be45f9 Reviewed-on: https://pdfium-review.googlesource.com/40592 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>