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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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 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>
|
|
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>
|
|
BUG=chromium:834557
Change-Id: I8fb8d74f87097b39608c3f83f2fa1c4e49e69980
Reviewed-on: https://pdfium-review.googlesource.com/31170
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This CL renames the 3 IFX files in core/fxcrt to Iface instead.
Change-Id: I7cee6836650b71bc5c5729a8147fda62f0910fe3
Reviewed-on: https://pdfium-review.googlesource.com/27970
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Ic1260417e7d1475dd518655b2ab08f0184955d88
Reviewed-on: https://pdfium-review.googlesource.com/27170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Bug: 808902
Change-Id: Iad5ab63eeedc3ea85001337ba73626178c71f8b8
Reviewed-on: https://pdfium-review.googlesource.com/26470
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
This reverts commit 77d8ed02c7e97471ceccee5abbabeb2fdea413c7.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Use UnownedPtr instead of T* in MaybeOwned."
>
> This reverts commit e563e8352139e4852a955e319023b09f2844aee9.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Use UnownedPtr instead of T* in MaybeOwned.
> >
> > Always check the liftime in the unowned case. Doing so unearthed
> > the following issues:
> >
> > Transient lifetime issue in jbig2_image when doing realloc().
> > Stale (but unused) dictionary pointer in CPDF_Image.
> > Destruction order in error branch in cpdf_dibsource.cpp
> >
> > Change-Id: I12b758aafeefedc7abe1e8b21a18db959929e95f
> > Reviewed-on: https://pdfium-review.googlesource.com/24552
> > Commit-Queue: Tom Sepez <tsepez@chromium.org>
> > Reviewed-by: dsinclair <dsinclair@chromium.org>
>
> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org
>
> Change-Id: I3c56ee6ab502da90e3adb7507dbc8cc92f090140
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://pdfium-review.googlesource.com/24670
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Commit-Queue: Tom Sepez <tsepez@chromium.org>
TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org
Change-Id: I0ccbbeab8be6cadc9b3a5bfefe2aca733654342f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://pdfium-review.googlesource.com/24671
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This reverts commit e563e8352139e4852a955e319023b09f2844aee9.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Use UnownedPtr instead of T* in MaybeOwned.
>
> Always check the liftime in the unowned case. Doing so unearthed
> the following issues:
>
> Transient lifetime issue in jbig2_image when doing realloc().
> Stale (but unused) dictionary pointer in CPDF_Image.
> Destruction order in error branch in cpdf_dibsource.cpp
>
> Change-Id: I12b758aafeefedc7abe1e8b21a18db959929e95f
> Reviewed-on: https://pdfium-review.googlesource.com/24552
> Commit-Queue: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: dsinclair <dsinclair@chromium.org>
TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org
Change-Id: I3c56ee6ab502da90e3adb7507dbc8cc92f090140
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://pdfium-review.googlesource.com/24670
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Always check the liftime in the unowned case. Doing so unearthed
the following issues:
Transient lifetime issue in jbig2_image when doing realloc().
Stale (but unused) dictionary pointer in CPDF_Image.
Destruction order in error branch in cpdf_dibsource.cpp
Change-Id: I12b758aafeefedc7abe1e8b21a18db959929e95f
Reviewed-on: https://pdfium-review.googlesource.com/24552
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:802983
Change-Id: I866ece9c370bf05571b76b50ad23598f5038332b
Reviewed-on: https://pdfium-review.googlesource.com/23151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Ifabaf71bb45ffa7e9af7da4acb21d8757e9596ce
Reviewed-on: https://pdfium-review.googlesource.com/23150
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This reverts commit dca380ffe0571be4023b11b06b8aecad9934bb06.
Reason for revert: Causes missing text in a user's PDF
Original change's description:
> Check for success of decodes to avoid infinite loops
>
> Bug: 790693
> Change-Id: I9b1d87e024229d8b01f55ec554e2cc544db6ac06
> Reviewed-on: https://pdfium-review.googlesource.com/20230
> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
TBR=npm@chromium.org,hnakashima@chromium.org,rharrison@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 790693
Change-Id: I886b14e120c34da757a96f8a1f9c6a081d8326b6
Reviewed-on: https://pdfium-review.googlesource.com/22950
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
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>
|
|
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>
|
|
Bug: 790693
Change-Id: I9b1d87e024229d8b01f55ec554e2cc544db6ac06
Reviewed-on: https://pdfium-review.googlesource.com/20230
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
In this CL we prevent integer overflow by checking that the integers are
in the appropriate range before casting from unsigned to signed.
Bug: 789524
Change-Id: I41572849f18ffb0f0739c80130ee6b5061845d29
Reviewed-on: https://pdfium-review.googlesource.com/20011
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Bug: pdfium:774
Change-Id: Ie7674ac55dea6284a0d974cef107ef357197a06b
Reviewed-on: https://pdfium-review.googlesource.com/19610
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This CL adds checks in CJBig2_GRRDProc to verify if the decoder is
completed before trying to decode. This is currently done in all
decoding calls in CJBig2_GRDProc.
Bug: chromium:782826
Change-Id: Ifb4ee4d09e8357e969aefa107b4dafbc2284324b
Reviewed-on: https://pdfium-review.googlesource.com/18333
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
This CL improves some method names and does other basic cleanup.
Change-Id: I32ea88ff29383e9685d4c686625088c96f73f035
Reviewed-on: https://pdfium-review.googlesource.com/18210
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
This CL changes the type of |m_dwOffset| to safe unsigned integer to
prevent the offset from cycling from MAX_UINT32 back to 0.
Bug: chromium:778912
Change-Id: Ib93a8392e52eecf2cc223438ac85e9dc529b0f43
Reviewed-on: https://pdfium-review.googlesource.com/18130
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Change-Id: Id53cbb8c95f6eb929f6e4eb57333daa24f1b776f
Reviewed-on: https://pdfium-review.googlesource.com/18010
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Bug: chromium:781780
Change-Id: Ie92d8b570c37e9b3364d1ff4502f444a275ee6c2
Reviewed-on: https://pdfium-review.googlesource.com/17910
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Bug: chromium:778961
Change-Id: I1d08b3282304931276c24e50392c10b21780dcde
Reviewed-on: https://pdfium-review.googlesource.com/16971
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Quoting the JBIG2 spec: "If B is a 0xFF byte, then B1 (the byte pointed
to by BP+1) is tested. If B1 exceeds 0x8F, then B1 must be one of the
marker codes. The marker code is interpreted as required, and the buffer
pointer remains pointed to the 0xFF prefix of the marker code which
terminates the arithmetically compressed data. 1-bits are then fed to
the decoder until the decoding is complete. This is shown by adding
0xFF00 to the C-register and setting the bit counter CT to 8."
Our implementation is the alternative (faster for software according to
the spec), where only CT is changed to 8.
Reaching this part of the code means we will never read from stream
again so we should be wrapping up the decoding. To ensure this, the
|m_Complete| attribute is set to true if we reach this code again,
which will result in bailing out next time DECODE is called.
Bug: 767156
Change-Id: I434d46bc7914713a065f0e4da079bbc9b5dd216c
Reviewed-on: https://pdfium-review.googlesource.com/16791
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Bug: 649278
Change-Id: Ib9084f6d9bb7dc7bf3713faa22d3a26822a96681
Reviewed-on: https://pdfium-review.googlesource.com/16550
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Remove unused defines.
Change-Id: Ibf10d8470f19cbf4528fe1342398a39ef15c1d12
Reviewed-on: https://pdfium-review.googlesource.com/15110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|