Age | Commit message (Collapse) | Author |
|
The existing implementation of Delete on the string classes handles
some cases where the range being deleted is out of bounds by clipping
it to the valid range. This behaviour can lead to programming problems
in the calling code being masked by the fact the Delete method still
does something. The new version of these methods does an early return
if the parameters are invalid.
This change also effectively removes support for negative string sizes
from the Delete method, so converting FX_STRSIZE to be unsigned will
be easier.
BUG=pdfium:828
Change-Id: Idbb4a62f70a75eba06e7809e011b25da2d7404c4
Reviewed-on: https://pdfium-review.googlesource.com/9890
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
The existing behaviour was to clamp the provided index to the valid
bounds. This would lead to programming errors being hidden, since
inserting would still do something even if the index calculation was
wrong. The behaviour of these methods has been changed to instead
early return when this occurs, returning the old length value. The
caller can check if the call to Insert actually did anything by
comparing the returned value to the length before calling insert.
All of the existing calls to Insert have been tested by running all of
the tests with asserts in the Insert method to check the index is in
bounds. Additionally the call sites have been manually inspected. The
majority of them are of the form Insert(0, foo) and the rest tend to
be in a loop advancing from 0 to length.
Convenience methods InsertAtFront/InsertAtBack have been added to
handle calling Insert when the intent is for the character to be added
to the beginning or end of the string. Existing call sites to Insert
that do this have been converted.
This work was originally being performed to check if there would be
any issues in these methods with making FX_STRSIZE unsigned.
BUG=pdfium:828
Change-Id: I60cee5ad45338aa8ed46569de7bcc78a76db18f7
Reviewed-on: https://pdfium-review.googlesource.com/9870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Instead of passing in a CPDF_PageObject* and then converting it to an
image, which is always what it is.
Change-Id: I146a476147f4b344417982b5ace002b9bd7b3d80
Reviewed-on: https://pdfium-review.googlesource.com/9810
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Callers removed in commit 4b78b18.
Change-Id: I6eec6ba18712040180b12d56b59c6a8379de4379
Reviewed-on: https://pdfium-review.googlesource.com/9750
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Bug: pdfium:731
Change-Id: I61d38ab3f2b0ac68b8479ade25bab50f3a73c27b
Reviewed-on: https://pdfium-review.googlesource.com/9770
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: I5deb6049db41387ac030a6ba5296ee6187120190
Reviewed-on: https://pdfium-review.googlesource.com/9470
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Make CPDF_Parser::ObjectInfo::pos a union, since the data is used as an
object number when the object is compressed.
Change-Id: Id7c32759f7411cc80285bb7f3088b5aa6ff5bf05
Reviewed-on: https://pdfium-review.googlesource.com/9570
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Helper for validate read problems locally,
Change-Id: I2bfbbaab8a67c0fd0cee3dadcd0f9cad5953101c
Reviewed-on: https://pdfium-review.googlesource.com/9552
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Fixes potential leaks in CPDF_Creator::WriteOldIndirectObject(), the
only caller.
Change-Id: I8a20da8a555c8d28f3bcd467a193a6a81c9f91d9
Reviewed-on: https://pdfium-review.googlesource.com/9751
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Iab34de5858ae06582023be220ef7dd0d1d0a91c9
Reviewed-on: https://pdfium-review.googlesource.com/9530
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
|
|
This CL removes the default param value for this method, which was
negative. It also adds in a method to get buffer lengths, so that the
callsites can explictly passing in the length of the buffer if they
were using the default value previously.
BUG=pdfium:828
Change-Id: I0170771ee81970b8b601631015ab3e6e39fea8ea
Reviewed-on: https://pdfium-review.googlesource.com/9790
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Currently Find() and other methods that return a FX_STRSIZE return -1
to indicate error/failure. This means that there is a lot of magic
numbers and magic checks floating around. The standard library for
similar operations uses a npos constant. This CL implements
FX_STRNPOS, and replaces usages of magic number checking. It also does
some type cleanup along the way where it was obvious that FX_STRSIZE
should be being used.
Removing the magic numbers should make eventually changing FX_STRSIZE
to be unsigned easier in the future.
BUG=pdfium:828
Change-Id: I67e481e44cf2f75a1698afa8fbee4f375a74c490
Reviewed-on: https://pdfium-review.googlesource.com/9651
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I52e668ca410a0c6b96a789ecc18c993152047ead
Reviewed-on: https://pdfium-review.googlesource.com/9550
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Bug: pdfium:839
Change-Id: I3a069bf7d8a75f32cf9bcc9e9926ad19aa006795
Reviewed-on: https://pdfium-review.googlesource.com/9650
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Instead of accessing the raw kTextLayoutCodeProperties data.
Change-Id: Ie39cf5c098e1564ae2f18d76b234af42f24db4ca
Reviewed-on: https://pdfium-review.googlesource.com/9451
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
|
|
Change-Id: I94b2e8f6fd522b97c917037e32fb3bcbeea0cbeb
Reviewed-on: https://pdfium-review.googlesource.com/8911
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
The various string/byte classes support Mid(), Left(), and Right() for
extracting substrings. Mid() can handle all possible cases, but Left()
and Right() are useful for common cases and more explicit about what
is going on.
Calls like Mid(offset, length - offset) can be converted to
Right(length - offset). Calls like Mid(0, length) can be converted to
Left(length).
If the substring being extracted does not extend all the way to one of
the edges of the string, then Mid() still needs to be used.
BUG=pdfium:828
Change-Id: I2ec46ad3d71aac0f7b513e103c69cbe8c854cf62
Reviewed-on: https://pdfium-review.googlesource.com/9510
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I218179565cd991b71fd9c909b94f967bbf80c74d
Reviewed-on: https://pdfium-review.googlesource.com/8912
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
The wrapper for IFX_SeekableReadStream.
Which allow us to check data availability on read request
and request downloading of non available data on fly.
Change-Id: I27c66cd58f43f8432f73104cc3f4c980515a9b56
Reviewed-on: https://pdfium-review.googlesource.com/9050
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I43ec0d4a3b60d51c59ba5a540dfe24803e725089
Reviewed-on: https://pdfium-review.googlesource.com/9170
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This CL uses sizeof to calculate sizes in tiffconf. It adds SIZEOF_VOIDP
to allow LibTIFF to take codepaths reducing OOMs. Finally, it gets rid
of _FX_WIN32_MOBILE_ since it's never defined.
Bug: chromium:718494
Change-Id: I9e6fb2812487ccd7d08e56fd1954c716ddccd07b
Reviewed-on: https://pdfium-review.googlesource.com/9410
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
This support is being removed from CFX_ByteString, CFX_ByteStringC,
CFX_WideString, and CFX_WideStringC. This standardizes all of these
classes to only have one Mid method that takes in 2 params, offset and
count. Count now must be positive. The old behaviour of calculating
the length for the user if -1 is passed in for the count has been
removed. This work is in preperation for converting these classes to
not accept negative lengths anywhere and thus make the underlying size
type unsigned.
BUG=pdfium:828
Change-Id: I5f15e7b7b00b264231817f143e2da88ee6f69e7b
Reviewed-on: https://pdfium-review.googlesource.com/9430
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
The base level is always 0 in much of the code.
Change-Id: I70b8342e0f6cf1dc366ff9f1d5d734d6f55ead0e
Reviewed-on: https://pdfium-review.googlesource.com/9254
Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
1. Added CPDF_NameTree::DeleteValueAndName() for deleting new name and
value pairs from a nametree. This function will be used for the API for
deleting embedded files.
* Added an anonymous helper function for updating the tree nodes
and limits upon deletion.
* Added a unit test.
Bug=pdfium:174
Change-Id: I3ee4c27af637f721ee0ccda26fbae3d3a5e58f5e
Reviewed-on: https://pdfium-review.googlesource.com/8931
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
CLRF characters seem to still work with label printer drivers, and some
users want to preserve these characters when printing. We cannot
distinguish new lines due to CLRF characters in the original text from
new lines created during layout, so just add the characters to all new
lines.
Bug: chromium:734850
Change-Id: I4d032a311c33e20a27b2cc1d5d0ba3eb9ef2fd41
Reviewed-on: https://pdfium-review.googlesource.com/9110
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
This CL adds a CFX_RTemplate constuctor which accepts a CFX_FloatRect
and converts to the correct type. It also adds a ToFloatRect() method
which returns a CFX_FloatRect. The CFX_FloatRect::FromCFXRect is
removed.
Change-Id: I6827345300c6c4dee02c4e5dfa5590f3c8088748
Reviewed-on: https://pdfium-review.googlesource.com/9114
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This CL updates some of the fx_coordinates methods to use std::min/max
as appropriate.
Change-Id: I12af519bfcbf97969da6fcc9e1bf978beb2d00e8
Reviewed-on: https://pdfium-review.googlesource.com/9113
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
The CFX_FloatRect params are Left,Bottom,Right,Top. Update comment to
match.
Change-Id: If4d8559e1f2693cfe0f7fcbe649add4c9a5bc303
Reviewed-on: https://pdfium-review.googlesource.com/9112
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Iacac67bce99b4b4bcc303fb388aaf03f2f99e4f3
Reviewed-on: https://pdfium-review.googlesource.com/9070
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Ibb7e33dddd79d6266961ebdf56600fc5a091dcb8
Reviewed-on: https://pdfium-review.googlesource.com/9071
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Most calls to the Skia Driver combine flushing
the draw cache with deleting the driver itself.
Progressive drawing needs to flush the cache to
keep drawing in order, but the driver must remain
for the next progressive draw.
R=dsinclair@chromium.org, hnakashima@chromium.org
Bug: pdfium:833
Change-Id: I311f80b2dc0ef6e4df9a3a0f082ae076cb7a591f
Reviewed-on: https://pdfium-review.googlesource.com/8890
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
1. Added APIs for adding attachments, setting attachment files, and
modifying attachment dictionary entries.
* Added two embedder tests covering all new APIs.
Bug=pdfium:174
Change-Id: I65f43cd6ca4887b71f9f7bcee64a87ba6b7e2706
Reviewed-on: https://pdfium-review.googlesource.com/8671
Commit-Queue: Jane Liu <janeliulwq@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
1. Added CPDF_NameTree::AddValueAndName() for inserting new name and
values pairs into a nametree while following nametree order rules. This
function will be used for the API for adding embedded files.
* Added anonymous helper functions.
* Added two unit tests.
Bug=pdfium:174
Change-Id: Ic3e2f32f7147ef5c164cf5c2a28e0a652ffed74a
Reviewed-on: https://pdfium-review.googlesource.com/8271
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
|
|
The use of Ready makes more sense then Reader for the constants. Rename
and deprecate the old one.
Bug: pdfium:830
Change-Id: I80b970f29a21068b41993c1880d81d406c3108e0
Reviewed-on: https://pdfium-review.googlesource.com/8790
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I24b191ecfe8b65a7d0ddc4958dc117de9ed9ae83
Reviewed-on: https://pdfium-review.googlesource.com/8630
Reviewed-by: Jane Liu <janeliulwq@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
The CFX_ListItem never calls the Height() method so doesn't need to use
CLST_Rect. This CL removes unused methods from CLST_Rect and
CPVT_FloatRect.
Change-Id: I82d4f07ec104345e9275ccd838e3c8eed1de7a50
Reviewed-on: https://pdfium-review.googlesource.com/8431
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Originally this would only calculate the length of the passed in
string if the passed in length was -1. This causes issues, since other
negative values will be passed straight through and break the
post-condition on the constructor of the length being
non-negative. This leads to undefined and hard to debug behaviour
later, in cases where the root cause is a mistake in calculating the
proper length.
The other related classes, CFX_WideString & CFX_ByteString, test for
all negative length values and calculating the length when they
occur. This CL changes the FooC versions to use this logic. This
implicitly assumes the string is null terminated, so in the incase of
an incorrect negative length and a non-null terminated string there
will still be a crash, but it will now occur at construction time,
instead of at some random later time.
BUG=pdfium:827
Change-Id: I4d1fed746ada67c496d8e6ab10861b9332555023
Reviewed-on: https://pdfium-review.googlesource.com/8450
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Replace uint8_t type to enum for ObjectType variables
Change-Id: Ie33c8c9413c5082397a2c6fbf73e03f08b7d8658
Reviewed-on: https://pdfium-review.googlesource.com/8470
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL creates CJBig2_HTRDProc::decode_image to reduce duplicated code
in the class.
Change-Id: Ie348179c96ff534f95cba401c4b9bd46e1c4e6ac
Reviewed-on: https://pdfium-review.googlesource.com/8410
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
Since there is no guarantee of termination if the StringC was
extracted from a snippet of another string. Make it more obvious
that things like
strlen(str.unterminated_c_str())
might be a bad idea.
Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2
Reviewed-on: https://pdfium-review.googlesource.com/8170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
PDFium doesn't strip BOMs during parsing, but we should strip BOMs when
retrieving parsed strings in CPDF_NameTree to ensure consistency and
appropriate function behavior. See the bug for more info.
As outlined in Bug=pdfium:593, the solution is to call GetUnicodeText()
instead of GetString(). I added a GetUnicodeTextAt() function in
CPDF_Array, which is symmetrical to GetUnicodeTextFor() in
CPDF_Dictionary.
I then changed the input variable types to CPDF_NameTree functions to
be CFX_WideString instead of CFX_ByteString, and modified all the
calls to them.
I also added a unit test for nametree, which would fail prior to this
change. Nametrees with non-unicode names are already tested by embedder
tests.
Bug=pdfium:820
Change-Id: Id69d7343632f83d1f5180348c0eea290f478183f
Reviewed-on: https://pdfium-review.googlesource.com/8091
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
|
|
Respin of https://pdfium-review.googlesource.com/c/6592 with fixes
that avoid invalid reads.
Bug: pdfium:731
Change-Id: I9395063505ba1a5c610e21b089ab8aa1a0a5b86f
Reviewed-on: https://pdfium-review.googlesource.com/8290
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
This reverts commit 7ca47d55c9cbbec7e0a0b0beffffe348ae655086.
Reason for revert: Caused pdfium:821
Original change's description:
> Converting CFX_ByteTextBuf to ostringstream in SAX.
>
> Bug: pdfium:731
> Change-Id: Ic492e8900c4a69082ff9c2384006a4e6bfa3313e
> Reviewed-on: https://pdfium-review.googlesource.com/6592
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Reviewed-by: dsinclair <dsinclair@chromium.org>
> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
TBR=thestig@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org
Bug: pdfium:731
Change-Id: Ic7390c3f53d67d6eecf7f669e329702daa16f339
Reviewed-on: https://pdfium-review.googlesource.com/8230
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
1. Added API for extracting attachment properties and data.
* Expanded the embedder test to cover all the new APIs.
Bug=pdfium:174
Change-Id: I09bffd412410e9aea45faca442d2b72eefafef4e
Reviewed-on: https://pdfium-review.googlesource.com/7790
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL removes the JBig2_GsidProc since it is only used as a single
instance in each of the methods in CJBig2_HTRDProc, so it is completely
unnecessary.
Change-Id: I69d0a4a059b9eb6ebcbbb79b92ea1cd6c22cb1cb
Reviewed-on: https://pdfium-review.googlesource.com/7930
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Use the overloaded << operator, which takes length into account
for StringC types, rather than a raw ptr (which gets promoted into
a std::string resulting in a length call that overflows since
StringCs aren't necessarily nul-terminated).
Bug: 746073
Change-Id: Iffbbff53e12da8741acc7ce54000232cc66d83bc
Reviewed-on: https://pdfium-review.googlesource.com/8150
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:738303
Change-Id: If36cdc0f53fc224c0c4c8cf775fd2c916f2d0add
Reviewed-on: https://pdfium-review.googlesource.com/8210
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL adds a FPDF_RENDER_TOBECONTINUED and marks
FPDF_RENDER_TOBECOUNTINUED as deprecated.
Change-Id: Ie08dbb2715d1d7959fbae17d9f23d7fcec410600
Reviewed-on: https://pdfium-review.googlesource.com/8070
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Bug:
Change-Id: Ic40d1fce83b6b13f638c522205a765c20f6ccd50
Reviewed-on: https://pdfium-review.googlesource.com/8090
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Cary Clark <caryclark@google.com>
|
|
This CL removes the drawing code from the AP stream generation code in
CPWL_Utils and places it in CFX_RenderDevice.
Change-Id: I5335fc38368740ba3ddc676ee856201a358979fc
Reviewed-on: https://pdfium-review.googlesource.com/7715
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|