Age | Commit message (Collapse) | Author |
|
This CL adds some checks to make sure the DecodeString method does not go out
out control:
If code is equal to code_table[code].prefix, it will try to loop forever.
Even if that's not the case, avoid reading a negative position from the stack.
Bug: chromium:722672
Change-Id: I638f91542ba21f3a9915198fef853cc3cf94f4f1
Reviewed-on: https://pdfium-review.googlesource.com/5513
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
This reverts commit dde95d8be9bc2817e34429fc38ee6d89d6d5ab75.
Reason for revert: the test added is flaky
Original change's description:
> Small fix in CPDF_TrueTypeFont load
>
> The ToUnicode map should not be ignored when it exists. Doing so can cause a
> charcode to be assigned an incorrect glyph index, and will result in garbled
> text.
>
> Bug: chromium:665467
> Change-Id: I21c1bf560a0731d974191d4189ea730ef9868334
> Reviewed-on: https://pdfium-review.googlesource.com/5512
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Commit-Queue: Nicolás Peña <npm@chromium.org>
>
TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,npm@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Bug: chromium:665467
Change-Id: I704a34f326d31018061bcfd857fb25f7e4ee4cc2
Reviewed-on: https://pdfium-review.googlesource.com/5493
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
In particular, prefer an explicit .release() call when handing
ownership of an object to a caller across a C-API.
Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1
Reviewed-on: https://pdfium-review.googlesource.com/5470
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
The ToUnicode map should not be ignored when it exists. Doing so can cause a
charcode to be assigned an incorrect glyph index, and will result in garbled
text.
Bug: chromium:665467
Change-Id: I21c1bf560a0731d974191d4189ea730ef9868334
Reviewed-on: https://pdfium-review.googlesource.com/5512
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
There are places where an object "child" has a raw pointer
back to object "owner" with the understanding that owner will
always outlive child.
Violating this constraint can lead to use after free, but this
requires finding two paths: one that frees the objects in the
wrong order, and one that uses the object after the free. The
purpose of this patch is to detect the constraint violation
even when the second path is not hit.
We create a template that is used in place of TYPE*. It's dtor,
when a memory tool is present, goes out and probes the first
byte of the object to which it points. Used in "child", this
allows the memory tool to prove that the "owner" is still alive
at the time the child is destroyed, and hence the constraint is
never violated.
Change-Id: I2a6d696d51dda4a79ee2f00a6752965e058a6417
Reviewed-on: https://pdfium-review.googlesource.com/5475
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Add a few constants in the process.
Change-Id: Id69b939e4ea6a3de879e0a1f29d1453e95c838db
Reviewed-on: https://pdfium-review.googlesource.com/5552
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The gamma value is always 2.2, which means the table entries all point
to themselves. Remove the usage of the gamma table.
Change-Id: Idbb06015e8acd9f106f4bd1da5ef06563fb26296
Reviewed-on: https://pdfium-review.googlesource.com/5352
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
The only user of CPDF_Creator is FPDF_Doc_Save, and it only uses flags 1
or 2 when calling Create. Thus, the other two flags will never be set.
Change-Id: Ib2eb0ce5585469c7749f0ab350855f1c6a2bba08
Reviewed-on: https://pdfium-review.googlesource.com/5491
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
From the Gif spec:
'The output codes are of variable length, starting at <code size>+1 bits per
code, up to 12 bits per code. This defines a maximum code value of 4095
(0xFFF).'
'Because the LZW compression used for GIF creates a series of variable length
codes, of between 3 and 12 bits each'
Bug: chromium:722115
Change-Id: Ic9cff99e6012195a6b5173693b029dc710285688
Reviewed-on: https://pdfium-review.googlesource.com/5490
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This Cl updates CPSOutput to inherit from IFX_WriteStream and converts
the CFX_PSRenderer to accept an IFX_WriteStream instead of a CPSOutput.
Change-Id: Ibde5c7da1c2f6df0a10cb6e9a470e18fbab167b8
Reviewed-on: https://pdfium-review.googlesource.com/5431
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This Cl allows passing a CFX_ByteStringC to IFX_WriteStream along with the
buffer method. This makes it easier to pass C-style strings to the stream.
Change-Id: I1051eb3ba17c7fbd42984c14dc60cbce24d72f3f
Reviewed-on: https://pdfium-review.googlesource.com/5430
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL fixes a leak that can be caused by a longjmp in ErrorData. The method
is renamed to express the fact that it includes such, and a followup should
remove the jmps altogether.
Bug: chromium:721488
Change-Id: Iefcc82a77a30ff77b7973b05611440a8d5bf275e
Reviewed-on: https://pdfium-review.googlesource.com/5450
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I60c9cbd83ff9e7a30a5a570a6ad1cf8f52360c07
Reviewed-on: https://pdfium-review.googlesource.com/5410
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
Change-Id: I9b7a1c101e3c73d0270f9216225e5a13d9937b97
Reviewed-on: https://pdfium-review.googlesource.com/5332
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This Cl renames the CFX_RenderDevice subclasses to make their usage
clearer.
Change-Id: Ie820b57df9a3743ce8c6893fb483b398a1f1bdbe
Reviewed-on: https://pdfium-review.googlesource.com/5390
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
The times we need the DC we call ::GetDC to retrieve it from the platform.
These methods are unused.
Change-Id: If83aa9b37ae2231d8029db6f2e6d8d17f1825611
Reviewed-on: https://pdfium-review.googlesource.com/5350
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Before, all pointers were being initialized to 0. After raw pointers were
changed to vectors, data() was used in some cases, but now no longer returns
nullptr when it is supposed to. This CL fixes that.
Bug: chromium:721417
Change-Id: Ia31b75b18dc17d7eed48538145fe5d0d59668843
Reviewed-on: https://pdfium-review.googlesource.com/5353
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
This Cl consolidates the code to load maps and codecs into the
CPDF_ModuleMgr class instead of putting it directly into fpdfview.
Change-Id: Ia08f212f43a33e51ab1c7832051ee4f28eecb50d
Reviewed-on: https://pdfium-review.googlesource.com/5335
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ibd8d70264d79afc0baabaa5093aceb21ee777196
Reviewed-on: https://pdfium-review.googlesource.com/5334
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
In AGG, len is of type coord_type, which we have as int16_t, but we can add to
it large values, causing it to become negative. Stop the rendering when that
occurs.
Bug: chromium:719258
Change-Id: Ic7497666b01220a9cd3e7d749f1fc6ae4a210870
Reviewed-on: https://pdfium-review.googlesource.com/5370
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
Change-Id: Ia0ea49f0460fcb8e55542f237d321bb9207aa8e1
Reviewed-on: https://pdfium-review.googlesource.com/5250
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
member.
Change-Id: I51e30d298e87b9ae0d5aca83b2f1d6787efce70a
Reviewed-on: https://pdfium-review.googlesource.com/5290
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
|
|
This Cl moves the implementation of the archive buffer behind an
IFX_ArchiveStream interface. The buffer holds the current offset and the
offset parameter is removed from the CPDF_Creator and various other
methods.
Change-Id: Ia54e803b58bbfb6ef03fec4a940d2c056d541356
Reviewed-on: https://pdfium-review.googlesource.com/5255
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This Cl conslidates if statements, converts int returns to bools where
possible and various other cleanups in fpdfapi/edit.
Change-Id: Ia31ecc69843117eb5ebfff449a6046a267d08e89
Reviewed-on: https://pdfium-review.googlesource.com/5190
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I9754da8d1bf54b328761ac9d83fcc4a3518b4a73
Reviewed-on: https://pdfium-review.googlesource.com/5230
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
Change-Id: Ia0a78be3320c5d6c3d0c40d4199cae1473e0e8dc
Reviewed-on: https://pdfium-review.googlesource.com/5253
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I84cd8e91a296119ecf80b7a092b886f291bebb45
Reviewed-on: https://pdfium-review.googlesource.com/4953
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Ic602126dc5407fcbb56dca5ec43e1824a5ca55b6
Reviewed-on: https://pdfium-review.googlesource.com/5251
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
They should each know what they are rather than having an
external ChildRecord struct to track the type.
Change-Id: Ic647ba45569764073e944d30af1a96dccdc29eb3
Reviewed-on: https://pdfium-review.googlesource.com/5210
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Minor cleans in the fpdfapi/edit code.
Change-Id: I7bb2f4add7c6e84f072501035b1f77c218174cca
Reviewed-on: https://pdfium-review.googlesource.com/5152
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL changes the tag_gif_decompress_struct into CGifDecompressor. It cleans
up a bunch of unnecessary function pointers and starts cleaning up the members
of the new class.
Change-Id: Id49cd8f5377dc8daaa15118551dadad4ddde7931
Reviewed-on: https://pdfium-review.googlesource.com/5170
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
This Cl moves the adapater out of the fpdfsave.cpp file into its own
h/cpp files. The adapter was renamed for clarity. The CPDF_Creator was
modified to take the adapter as a constructor param and the Create
methods consolidated.
Change-Id: Icb104f195ef532dda053c859aae356a8d4a7a54c
Reviewed-on: https://pdfium-review.googlesource.com/5151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This Cl renames the fpdf_edit_create file to better match the
cpdf_creator content. The CPDF_ObjectStream and CPDF_XRefStream code is
moved out to their own .cpp files. Needed anonymous classes are split
out as well.
Change-Id: Ic83fb319ce28c816db82a4286e22032dc68811bc
Reviewed-on: https://pdfium-review.googlesource.com/5171
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
|
|
Layering prevents the (newly-moved) CFX_Char from knowing about
this class, so some casting is still required.
Change-Id: I5b7556fdfa80d09e5116b171b01ab5e707763bf0
Reviewed-on: https://pdfium-review.googlesource.com/5172
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This Cl creates a cpdf_objectstream and cpdf_xrefstream headers from the
editint header.
Change-Id: I857981fa055ee9296cbd344860e55c67acf200ce
Reviewed-on: https://pdfium-review.googlesource.com/5113
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
|
|
This CL removes the friend declarations from CPDF_Creator and adds
accessor methods instead.
Change-Id: I6d8f67b5944aed34af00ff6ea9d23fe7d17cec18
Reviewed-on: https://pdfium-review.googlesource.com/5112
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The AppendObject method has been removed and the functionality moved
to the individual CPDF_Object classes.
Change-Id: I5446c6cc3e792d849acf77caed34b63a88f3a2d2
Reviewed-on: https://pdfium-review.googlesource.com/5072
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This Cl removes un-needed prefixes from anonymous method names and
cleans up various defines.
Change-Id: If46a04c80460bb675af68d1e08d3093855d8fb19
Reviewed-on: https://pdfium-review.googlesource.com/5111
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I9306afed2747e3b0054adeea1d39916cac47f5c5
Reviewed-on: https://pdfium-review.googlesource.com/5091
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
When decoding the CPDF_HintTable we read the dwDeltaGroupLen value out
of the input stream which is a 16bit number. That value is then passed
in to read a uint32_t of the object number. If we have a group length of
> 32 bits we'll cause an undefined shift when we attempt to shift right
more then 32 bits.
This Cl bails out early if the dwDeltaGroupLen value is > 32 in order to
stop the undefined shifts.
Bug: chromium:718505
Change-Id: I919d6f4cd19826094a5e44d3a65d758029f5c236
Reviewed-on: https://pdfium-review.googlesource.com/5090
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
In a way similar to the existing USE_SYSTEM_LIBJPEG. The default is of
course still the DEPS-based zlib checkout.
Changes in v2:
1) Since Chromium doesn't have //third_party:zlib (AKA a "zlib" target in
//third_party/BUILD.GN) all the targets that depended on //third_party:zlib now
depend on third_party:zlib, which always points to PDFium's
third_party/BUILD.GN. The targets that depended on //third_party:zlib in
third_party/BUILD.GN just depend on :zlib instead.
2) Move the zlib bits out of !build_with_chromium block.
Change-Id: Id73eb07591418ff2ae71b83b87c18af71b49a22a
Reviewed-on: https://pdfium-review.googlesource.com/5030
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Consolidate all of the sha2 contexts while we're at it, the one
with the largest buf is suitable for use by all the others.
Change-Id: Iace6cd8ca4405f75f78842a1559c3a2478910218
Reviewed-on: https://pdfium-review.googlesource.com/4994
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Avoid casting willy-nill over uint8_t*s, since there's at
least one place where the wrong cast could be applied.
Use std::vector<> as well.
Use ByteRange struct to avoid the seg[i * 2 + 1] anti-pattern.
Change-Id: I9278ccc3a545b2640f0daf101a0c8b1d5c5564f8
Reviewed-on: https://pdfium-review.googlesource.com/5012
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
This CL cleans up a bunch of nits and improves ownership in the CStretchEngine
class.
Change-Id: I6527f29c50dab329ef58d0724cd24b94fca50ee6
Reviewed-on: https://pdfium-review.googlesource.com/4970
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Bug: pdfium:667
Change-Id: I811571c334ff28162905a65781ca14f03caf2966
Reviewed-on: https://pdfium-review.googlesource.com/4910
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Use much longer descriptive identifiers while at it.
Pack a little tighter while at it, too.
Change-Id: I123025f6433a627b5e00ee225efa7dc843b07913
Reviewed-on: https://pdfium-review.googlesource.com/5011
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Remove IFX_Pause parameters which are passed but not used.
Change-Id: I51a491c7f9a429676d114a387390fac3ae65e187
Reviewed-on: https://pdfium-review.googlesource.com/4950
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Using a ByteBuffer and an array of uint8_t's isn't how one
would represent an array of structured data. Packing uint16_t's
into a uint32_t via / and % isn't ideal, either.
Bug:
Change-Id: Ib09ae2659ba2f027724546bb7aef99bdfd2dea25
Reviewed-on: https://pdfium-review.googlesource.com/4951
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
- FXSYS_toDecimalDigit() becomes FXSYS_DecimalCharToInt().
- FXSYS_toHexDigit() becomes FXSYS_HexCharToInt().
Change-Id: If4683e8f85f05124b92ff075056cbc295442087d
Reviewed-on: https://pdfium-review.googlesource.com/4930
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Add a comment to clarify and remove some unneeded checks.
Change-Id: I8b0492548b245abc45e161085047c9f36d6c8e2b
Reviewed-on: https://pdfium-review.googlesource.com/4871
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|