Age | Commit message (Collapse) | Author |
|
This changes the implementation for the specific bug listed and
proactively fixes it in the other overrides. The general bug here is
that if you concat a WideString in a tight loop without first
reserving space, each call will cause an allocation size change and
memcpy. This is very expensive and causes ClusterFuzz cases to
timeout.
BUG=chromium:863295
Change-Id: I6c1d900a31b98cd9ddcf91d1ec0f3973c9cdfa26
Reviewed-on: https://pdfium-review.googlesource.com/38110
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Other cleanups:
Remove unused method.
Fold Init() into constructor.
Return span<> where possible.
Change-Id: Ie38d32efb6e63d86ae24e93684903a6dd900810f
Reviewed-on: https://pdfium-review.googlesource.com/36810
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Remove some string copies in barcode that were noticed whilst
looking for moves.
Change-Id: Ieda34d00f633576ba1f0dca283dcdabfb36f236c
Reviewed-on: https://pdfium-review.googlesource.com/35410
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Because its a code smell of a sort.
Change-Id: Id1c1b124f539e31a929701fb9486da9d396d3563
Reviewed-on: https://pdfium-review.googlesource.com/34695
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This fixes a number of instances where a value is written out to a
variable, but never used in the barcode. There are three different
types of fixes employed in this CL. If the non-use is a bug, then
rewrite the code to actually use the value. If it is an assignment
with no side effects, then just remove the entire line. Finally if it
is an assignment of a function return value, cast it to void instead
to clearly mark that the return is being ignored.
Issues found with Clang Static Analyzer.
Change-Id: If13a3684cb2db81592cce9a798788a26fcdb4c6d
Reviewed-on: https://pdfium-review.googlesource.com/33771
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
During encoding, the code is going to walk through every character in
m_msg and determine what values need to be added to m_codewords. The
ceiling on the number of characters being added to m_codewords is the
length of m_msg, so reserving enought space in advance. This prevents
thrash related to incrementing the string and thus resizing in a tight
loop.
BUG=chromium:846027
Change-Id: Icefd6955933f8068feeeee6243e430f60c50d747
Reviewed-on: https://pdfium-review.googlesource.com/32990
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Get rid of a few more fxbarcode exception codes.
Change-Id: Ia9c9cdcef581174e25be8dc2fba181915dc6d729
Reviewed-on: https://pdfium-review.googlesource.com/32471
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Rolling two iterations over the input into one, and reserving the
maximum possibly output size to avoid memory thrash when
appending. Under Valgrind this reduces the instruction count by ~200x
BUG=chromium:837610
Change-Id: If12a3b98048b41906a4401d4dcc9470b513e28d2
Reviewed-on: https://pdfium-review.googlesource.com/31731
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Another couple of examples where the slow down in the barcode code
can be fixed by reserving and thus pre-allocating the buffer that
backs the Widestring. Doing += in a tight loop caused reallocation
thrashing.
BUG=chromium:834630
Change-Id: I48a802225351bcaf992c324732fddf81639b4898
Reviewed-on: https://pdfium-review.googlesource.com/31230
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Follow up to request in
https://pdfium-review.googlesource.com/c/pdfium/+/30190
BUG=chromium:802242
Change-Id: I8fddd78d235a195c9782c3f6ced428de965e85eb
Reviewed-on: https://pdfium-review.googlesource.com/30250
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
In the test case from the bug, the majority of the time is being spent
resizing Widestring internal buffers, since += is being called in a
tight loop. Since the size of the input being mutated and stored is
known, this CL reserves the space before hand to lower thrashing. This
substantially improves runtime of this test case locally.
BUG=chromium:802242
Change-Id: I5176dabc94634b4d6bc3e9425fe6469a5bf35a41
Reviewed-on: https://pdfium-review.googlesource.com/30190
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
It currently takes const FX_RECT*, but the pointer is never nullptr.
Change-Id: I571e9e8dd04756bc4daa25a61a5af8d1f902914b
Reviewed-on: https://pdfium-review.googlesource.com/30052
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This might make the memory tools more effective in finding OOBs.
Change-Id: Id093bb0a88c37954c80d612ac00b5a168e75bdbf
Reviewed-on: https://pdfium-review.googlesource.com/29550
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@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>
|
|
Get things out of the .data section.
Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683
Reviewed-on: https://pdfium-review.googlesource.com/27130
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Bug: 806612
Change-Id: I22bd9046dd37a1b596762c46a6b29a323d6e9fa1
Reviewed-on: https://pdfium-review.googlesource.com/24410
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
This is a follow-up to comments from
https://pdfium-review.googlesource.com/c/pdfium/+/22870
Change-Id: Ide35ea5b27ea12d480d979241801c7676b94fe74
Reviewed-on: https://pdfium-review.googlesource.com/22932
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=pdfium:964
Change-Id: Ic306a374bc9b710e2ac043eebe43504e5bd75926
Reviewed-on: https://pdfium-review.googlesource.com/22870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@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>
|
|
Found by GCC.
Change-Id: Ia403c21b1906ba6782b5a763c67a19a56de01716
Reviewed-on: https://pdfium-review.googlesource.com/19810
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Remove unused defines; Move to .cpp files where possible; Fixup values.
Change-Id: I88cd5deb04b14ab8e9f8097a695c3d0b52d64b4c
Reviewed-on: https://pdfium-review.googlesource.com/15130
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL simplifies the OS == WIN{32|64} checks to be PLATFORM == WINDOWS
checks.
Change-Id: I1493d316dd457b0228e4ef39db4cf1d2b8abf97d
Reviewed-on: https://pdfium-review.googlesource.com/14870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL moves the CFX_Font definition out of fx_font.h and into
cfx_font.h to match the cfx_font.cpp implementation.
Change-Id: Icc2fc7463fa4b9d0bec925e80b60a638136a83a1
Reviewed-on: https://pdfium-review.googlesource.com/14951
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
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>
|
|
This CL renames the FX_OS defines to have _OS_ in their names and drops
the _DESKTOP suffix. The FXM defines have been changed to just FX.
Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74
Reviewed-on: https://pdfium-review.googlesource.com/14833
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
The _FX_IOS_ define is never defined, so it isn't useful to check
_FX_OS_ against. Remove.
Change-Id: I90b50a1a0dc165073ed223cbfe861b9a227818dd
Reviewed-on: https://pdfium-review.googlesource.com/14831
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Several of the OS checks were mis-typed as FX_WIN64 instead of
FX_WIN64_DESKTOP. This CL updates the defines to check for the correct
OS define.
Bug: pdfium:906
Change-Id: Ib58a6472d1bc26c34d509edf32ac00b18d852a3b
Reviewed-on: https://pdfium-review.googlesource.com/14813
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
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>
|
|
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>
|
|
While Chromium's clang and libc++ implicitly end up including that header,
the build can break with other toolchains (e.g. GCC 7 and its libstdc++)
because some headers reference types such as int32_t without including the
header that defines them.
Change-Id: Ibb2aa3d3b432f4b47f1b8635d0196d4f69cb09a0
Reviewed-on: https://pdfium-review.googlesource.com/14270
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
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>
|
|
The algorithm is the same.
Change-Id: Ia5713f6b1602aafac546047b8d398048d6532686
Reviewed-on: https://pdfium-review.googlesource.com/13290
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Bug: pdfium:882
Change-Id: I609adfa652285fe1702f742a2774ffa566471d5c
Reviewed-on: https://pdfium-review.googlesource.com/13270
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change the underlying type for FX_STRSIZE to size_t from int. This
will make the value unsigned and thus all values in the range of the
type will be valid. This allows for the final remove of negative
length strings, but also introduces a some casting and functional
errors, since many parts of the code base assume that FX_STRSIZE is
int or another signed type. This also CL fixes these errors.
BUG=pdfium:828
Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b
Reviewed-on: https://pdfium-review.googlesource.com/11830
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Bug: pdfium:882
Change-Id: Ieb06c4c060307bffa6e4fe20c7ced6be6518adca
Reviewed-on: https://pdfium-review.googlesource.com/13190
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Bug: pdfium:882
Change-Id: Ib73abbbc9499e1adef561d7a0ad15dc4eb51234f
Reviewed-on: https://pdfium-review.googlesource.com/13150
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
isDevice is currently false in tests and fuzzers and true in real
usage. This CL changes it all to true.
Change-Id: Idea14795d7f0bb70031e04e5c58e248de72fd39e
Reviewed-on: https://pdfium-review.googlesource.com/13130
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Bug: pdfium:882
Change-Id: I900d3c1b0b74523fa9e4497da65c68eb307ea6dc
Reviewed-on: https://pdfium-review.googlesource.com/12950
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Parity in EAN-13 is considered counting digits from right to left,
starting at 1.
Bug: pdfium:882
Change-Id: I3e586499091b8400daf93657eb9878f29d9e6922
Reviewed-on: https://pdfium-review.googlesource.com/12910
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Mid(foo, 1) is equivalent to [foo], if all you want is the character. Similarly
Left(1) is [0]. It is faster also, since it does not need to create intermediate
strings.
Right(1) is a touch more tricky, since it requires something like GetLength() ?
[GetLength() - 1] : 0;. A new method, Last() has been added to perform this
character extraction.
Multiple call sites have been updated to use more efficient/simpler
syntax. There are a number of call sites that use on these patterns, but based
on the surrounding context we actually need/want a string, so they have not been
modified.
Change-Id: I485a7f9c7b34c9bdacecada610158f996816afdd
Reviewed-on: https://pdfium-review.googlesource.com/12890
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
When turning on this conversion a number of typing issues and other nits where
found in the code base that can be merged in without actually changing the
underlying type. Landing these changes before the type change CL, since there is
a high likelihood that the type change will need to be rolled back, since it is
high risk.
BUG=pdfium:828
Change-Id: I587443d9090055963446485a1aacb8772eb5ca64
Reviewed-on: https://pdfium-review.googlesource.com/12810
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Adjust loop conditions and behaviours in preperation for convering the
underlying type of FX_STRSIZE to size_t. These changes are not
dependent on the type switch occuring, so can be landed before hand.
BUG=pdfium:828
Change-Id: I5f950c99c10e5ef0836959e3b1dd2e09f8f5afc0
Reviewed-on: https://pdfium-review.googlesource.com/12750
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
Reverts a piece of
https://pdfium-review.googlesource.com/c/pdfium/+/12210
Bug: chromium:760857
Change-Id: I290ebb7b60a6508fc3e8fba6780c837d395c1c3b
Reviewed-on: https://pdfium-review.googlesource.com/12690
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
The various string classes, CFX_ByteString, CFX_ByteStringC,
CFX_WideString, and CFX_WideStringC, have many conditionals that are
effectively determining if a value is a valid index or length. This CL
refactors the logic into one place per class, so it only needs to be
changed once if its behaviour needs to change. It also make the some
of the methods stricter on the inputs they will accept.
BUG=pdfium:828
Change-Id: Iadcdaa34a6d862a2804485770027179c89dc6956
Reviewed-on: https://pdfium-review.googlesource.com/12030
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
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>
|
|
Currently, all three of CFX_Matrix::TransformRect() take in rect values
and modify them in place.
This CL converts them to take in constant values and return the
transformed values instead, and fixes all the call sites.
Bug=pdfium:874
Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b
Reviewed-on: https://pdfium-review.googlesource.com/11550
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
|
|
This method duplicates the behaviour of the const [] operator and
doesn't offer any additional safety. Folding them into one
implementation.
SetAt is retained, since implementing the non-const [] operator to
replace SetAt has potential performance concerns. Specifically many
non-obvious cases of reading an element using [] will cause a realloc
& copy.
BUG=pdfium:860
Change-Id: I3ef5e5e5a15376f040256b646eb0d90636e24b67
Reviewed-on: https://pdfium-review.googlesource.com/10870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Since m_pos is passed into GetAt() on the underlying string in
getCurrentChar(), the value of it needs to confirmed to be valid after
decrementing. Some types were changed to reflect the values being
stored.
BUG=chromium:752480
Change-Id: Ib6d6f52326defd31785e70a17049a08b64dbe069
Reviewed-on: https://pdfium-review.googlesource.com/10652
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|