Age | Commit message (Collapse) | Author |
|
This CL cleans up variables in CJBig2_Context. It moves some
declarations further, to when the variables are actually used. It also
caches huffman tables in a vector of unique_ptr.
Change-Id: Id3af96f9526b1000f681e4e2b174bba07b45ee55
Reviewed-on: https://pdfium-review.googlesource.com/32715
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Just use memcpy() and memset().
Change-Id: Id6c6fab4e65a5524786ae318270c5981313825f2
Reviewed-on: https://pdfium-review.googlesource.com/32743
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Nobody reads it.
Change-Id: I76c0f5881e5432d2086cb8eaec7fc70fa5b71536
Reviewed-on: https://pdfium-review.googlesource.com/32741
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Rename fooBar() to FooBar().
Change-Id: I87775fa14ce7e4f4a5897780d0d02fb61c7693ff
Reviewed-on: https://pdfium-review.googlesource.com/32739
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
In CCodec_FaxDecoder::v_GetNextLine(), a fixed size vector often needs
to be inverted. Doing so without checking bounds on every access makes a
big difference in non-optimized builds.
BUG=chromium:843899
Change-Id: Iecc0a3da22631a289745245563dab7a7c3c458d0
Reviewed-on: https://pdfium-review.googlesource.com/32744
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
CJBig2_Image::ComposeFrom() wraps a call to ComposeTo() and does an
extra validity check. In tight loops where the validity check will
always succeed, this is wasteful. Change existing callers of
ComposeFrom() to ComposeTo() when the validity check has already been
done.
BUG=chromium:840728
Change-Id: I39fb42eea49b92b7804cbd42c3d8a0329edeb58d
Reviewed-on: https://pdfium-review.googlesource.com/32637
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: Ib44a6b7bd19625a4081322d2471551bec894abd8
Reviewed-on: https://pdfium-review.googlesource.com/32638
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Import Chromium's base/compiler_specific.h from r537069.
Now that FALLTHROUGH is available via compiler_specific.h, remove
FX_FALLTHROUGH.
Change-Id: I8b9631a4f007673e10e0c26951dfd61e9dcada30
Reviewed-on: https://pdfium-review.googlesource.com/32639
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This CL changes the table information so it can be indexed, and allows
moving all of the information to the CJBig2_HuffmanTable implementation,
which is the only real user of the data.
Change-Id: I88780bee32c8509198518fd3b1e82d68ae7ff707
Reviewed-on: https://pdfium-review.googlesource.com/32635
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Bug: pdfium:1085
Change-Id: I62c526ae865f0cadfddd2e75a616bce73de0f88d
Reviewed-on: https://pdfium-review.googlesource.com/32632
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ibbc020393e38405f9d1cb0d483ef875777d4e721
Reviewed-on: https://pdfium-review.googlesource.com/32650
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
FindBit() is called frequently by other fax codec code. Use 16 more
bytes of space to store the two possible values memset() can set.
Change-Id: Ibeb549c44928bbb468ac4eb4cef2d9339cf6490d
Reviewed-on: https://pdfium-review.googlesource.com/32630
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Use the same limit as JBIG2 codecs.
BUG=chromium:834633
Change-Id: I11d12c841e10ab48fd85df792bf8a034fe40493c
Reviewed-on: https://pdfium-review.googlesource.com/32514
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
In case there are long runs of data to be skipped, FindBit() runs much
faster reading and comparing 8 bytes at a time.
BUG=chromium:834633
Change-Id: Ifc7b348d123c5a72cf09fbf53d764075f8abfba0
Reviewed-on: https://pdfium-review.googlesource.com/32513
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
This CL merges some of the values of JBig2_Result. The only checks are
against Success and EndOfFile || EndOfPage, so we only need three
values: Success, EndReached, and Failure (for anything that does not
match either of those two).
Change-Id: I552c54f2d70aa8e8bf52702dab4dfc00d528ef76
Reviewed-on: https://pdfium-review.googlesource.com/32393
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Cleaning up some nits that came in after my previous codec CL had gone
into the CQ.
BUG=pdfium:1080
Change-Id: I3845136d370f73c9c96ef732e95b8cf0c9c79d91
Reviewed-on: https://pdfium-review.googlesource.com/32351
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
https://pdfium-review.googlesource.com/c/pdfium/+/18333 introduced
several checks to prevent timeouts in JBig2. One of these is breaking
the PDF in the bug, so this CL removes that check.
Bug: chromium:841200
Change-Id: Ia75c699b7fddc26f0353b0d64349898c4d1f744d
Reviewed-on: https://pdfium-review.googlesource.com/32250
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Currently all of the BMP related code is being built when support for
the codec is disabled, it just isn't being utilized. Depending on the
settings being used, this unneeded code may or may not get stripped
during linking.
This CL explicitly turns off building the BMP codec code if support
for BMP is turned off.
BUG=pdfium:1080
Change-Id: I56d40639a5a3631f9c601a1eef3f98873feac94f
Reviewed-on: https://pdfium-review.googlesource.com/32370
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL changes CJBig2_Context return methods as follows:
* Internal methods return JBig2_Result instead of int.
* Public methods return a bool (for success/failure) instead of int.
In a followup, several of the enum class values may be merged together
since they are not all needed.
Change-Id: Ifdab83b8037262370cd7c4a80e94aa94d59aa589
Reviewed-on: https://pdfium-review.googlesource.com/32310
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Currently all of the GIF related code is being built when support for
the codec is disabled, it just isn't being utilized. Depending on the
settings being used, this unneeded code may or may not get stripped
during linking.
This CL explicitly turns off building the GIF codec code if support
for GIF is turned off.
This also catches a few missed cases from previous CLs.
BUG=pdfium:1080
Change-Id: Ie7fe2d894d2ae2f8f36ae05e0ff256f2ce6ef8d4
Reviewed-on: https://pdfium-review.googlesource.com/32330
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Currently all of the PNG related code is being built when support for
the codec is disabled, it just isn't being utilized. Depending on the
settings being used, this unneeded code may or may not get stripped
during linking.
This CL explicitly turns off building the PNG codec code if support
for PNG is turned off.
BUG=pdfium:1080
Change-Id: I9c5247145fcadbcb1bd2243aa83350304ba421ff
Reviewed-on: https://pdfium-review.googlesource.com/32270
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Instead of allocating an N-pixel array to store some temporary values,
just use a single integer.
BUG=chromium:840728
Change-Id: I7a0ff83d814eff127033f25020a7c398db3c2062
Reviewed-on: https://pdfium-review.googlesource.com/32290
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Currently all of the TIFF related code is being built when support for
the codec is disabled, it just isn't being utilized. Depending on the
settings being used, this unneeded code may or may not get stripped
during linking.
This CL explicitly turns off building the TIFF codec code if support
for TIFF is turned off. It also fixes cases in the code base where tif
was being used instead of tiff.
BUG=pdfium:1080
Change-Id: If6aaa8af5160fdd5b261e63bab7d5984196efcc9
Reviewed-on: https://pdfium-review.googlesource.com/32193
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Tested by running safetynet_compare.py on this patch vs master. The
results were 0 regressions and 0 improvements. The two remaining usages
cannot be replaced because they would cause a regression.
Bug: pdfium:177
Change-Id: I43eddf4ffaac2eb063f2004d6606bc3cd6e627ac
Reviewed-on: https://pdfium-review.googlesource.com/32159
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Move the predictor code into the CCodec_FlatePredictorScanlineDecoder
sub-class.
Change-Id: I5a56ba5e051cf55e8fdd039bd38089684ed257be
Reviewed-on: https://pdfium-review.googlesource.com/31272
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Use it in more places there.
Change-Id: I477670a5946ec9033ad5f2bef0fbcddb52682066
Reviewed-on: https://pdfium-review.googlesource.com/31271
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Skip a lot of work that will all fail anyway.
BUG=chromium:838347
Change-Id: Iba45120e436b5547e106feb27dadea92cc948258
Reviewed-on: https://pdfium-review.googlesource.com/32053
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
The current implementation of the GIF codec does not handle the file
cursor moving backwards correctly. Specifically the input buffer that
the data is being read into is not invalidated, so if the entirity of
the buffer hasn't been consumed, a chunk of it will be moved to the
front before reading in more data, which is just
incorrect. Additionally, depending on the specific series of
operations, it is possible that the buffer was allocated for more
space then had been read into it and the uninitialized portion at the
end is being copied to the beginning.
The file cursor may move backwards when dealing with an animated gif
or other image with multiple frames, since all of the control data is
read in on load, and future calls specify what frame to fetch. The
code has been changed to treat the input buffer as invalid when moving
the cursor to a frame location, which will bypass any of the
problematic unused saving behaviour. A call to std::min has been added
to prevent allocation of an input buffer larger then the file size.
Additionally this CL refactors GifReadMoreData to be clearer about
what calculations are occuring, since the existing code reuses a
number of vaguely named variables, making it difficult to follow.
BUG=chromium:839348, chromium:839361
Change-Id: I2865658187bdf30bcad13ef4cac4f51a8966db11
Reviewed-on: https://pdfium-review.googlesource.com/32054
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
BUG=pdfium:1007
Change-Id: Ib8aecf2e4833f22a4288f6e1381edc11d114c865
Reviewed-on: https://pdfium-review.googlesource.com/31952
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
BUG=chromium:837972
Change-Id: I6cfa28bff38870419e4b1e2bced427cfcbf843cd
Reviewed-on: https://pdfium-review.googlesource.com/31912
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Track the decode state in one data structure. Also grab pointers to data
structure members before tight loops when decoding. It turns out
referring to this->foo in tight loops can actually slow down decoding.
Change-Id: I6a09b08ca06ef05968966055b5ad20f8c89896af
Reviewed-on: https://pdfium-review.googlesource.com/31790
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
- Mark them private when possible.
- Disambiguate method names.
- Make method names match the style guide.
- Pass in rects by reference.
Change-Id: I0bf848756e81a92d20e46a81cd6260b660eaf482
Reviewed-on: https://pdfium-review.googlesource.com/31772
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Use C++ style struct syntax (file already has other C++ features).
Assert that things have packed as intended since they map to
known layouts. Order these asserts in the same order as .h file.
Change-Id: I0a006c4b5789fb544783f488d5b4e609e32c7ec1
Reviewed-on: https://pdfium-review.googlesource.com/31654
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Use CJBig2_Context::HuffmanAssignCode() instead.
Change-Id: Ief187420494a8cefa26eeedb98a55683caf7807b
Reviewed-on: https://pdfium-review.googlesource.com/31538
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
The type is known where we need it, and we avoid some dubious
casts in the process. Also avoid clumsy indexing and use the
members directly in computations.
Bug: pdfium:243
Change-Id: I1e061465fd0f9045cf5b82067204f26ac7df53f0
Reviewed-on: https://pdfium-review.googlesource.com/31651
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I6461f81a3d8005efa75b8141c18c502a63252883
Reviewed-on: https://pdfium-review.googlesource.com/31537
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
It looks a lot like CJBig2_HuffmanTable::InitCodes(). Port over the
UBSAN error fix from commit 76c9a1b1.
BUG=chromium:709781
Change-Id: I5d2f8fb013c09099c82b0565627b77e4fb0f8a98
Reviewed-on: https://pdfium-review.googlesource.com/31536
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
One of its parameters is a member variable.
Change-Id: I0dcb78275d9ea5b05a77e211d178a0efb8699395
Reviewed-on: https://pdfium-review.googlesource.com/31535
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Pick from a set of functions before calling it, instead of having code
to call all of the functions with the same parameters.
Change-Id: I7f479948f50bdc1a9eb2764d5eb7505dc7434418
Reviewed-on: https://pdfium-review.googlesource.com/31533
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Also remove method parameters that always refer to the same member
variables.
Change-Id: I9751d63895cc59e5280283795e39b50fd42eef94
Reviewed-on: https://pdfium-review.googlesource.com/31532
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
It only looks for a single segment type.
Change-Id: I83457c6f74c210299caec79a563e7876f4d1d9ea
Reviewed-on: https://pdfium-review.googlesource.com/31534
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: Ie700e132f13f2cb4851ea59b68c891e3c42af243
Reviewed-on: https://pdfium-review.googlesource.com/31531
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: Ic2acd6f03b9b2e52b3d94d7579d5dc36c8e62c96
Reviewed-on: https://pdfium-review.googlesource.com/31530
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
BUG=chromium:836872
Change-Id: I0362fd7708043648bffa26c9248b401ea2793a21
Reviewed-on: https://pdfium-review.googlesource.com/31510
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
BUG=chromium:837192
Change-Id: Ib9c0e7b4aeb6501e81308844d344a784f7c138d8
Reviewed-on: https://pdfium-review.googlesource.com/31490
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: Ic62f1def8e043494c9fa6c08a937d7d872513567
Reviewed-on: https://pdfium-review.googlesource.com/31314
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
GIF extensions are laid out as follows: <size byte> <chunk of data>
<size byte> <chunk of data> ... <terminator byte>. The decoder needs
to scan along the data, finding the size bytes to determine where
the block ends in the stream, even if we don't care about the
content. Currently the decoder is storing all of the data chunks,
which are never used and take a lot of time to concat together if
they are very small.
Our implementation of the GIF spec does not handle this extension, so
when scanning for the end of the block, just don't bother storing
data from it.
BUG=chromium:833168
Change-Id: Iadf3ab3afd8145b6c5c7c22c30fe9316efcafc15
Reviewed-on: https://pdfium-review.googlesource.com/31315
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: If75c0db94d341715e0bc6406f0fd89812f1ea73c
Reviewed-on: https://pdfium-review.googlesource.com/31311
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: Ifbacab2868232a5597ef782fb24a749ebb4871bf
Reviewed-on: https://pdfium-review.googlesource.com/31270
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
- Merge Create() with the ctor.
- Initialize all member variables and mark them const when possible.
- Add an enum class for the predictor type.
- Move it into an anonymous namespace.
Change-Id: If7bb62ddf4a4e00ec2d02355e7c178028a7c187c
Reviewed-on: https://pdfium-review.googlesource.com/31233
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|