Age | Commit message (Collapse) | Author |
|
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>
|
|
Clean up being done in preperation for removal of negative length
strings. This means that FX_STRSIZE will become unsigned so the return
methods cannot return -1. Other cleanup suggested by reviewers is
included.
BUG=pdfium:828
Change-Id: I2cfb78c8ab7738516e0c9f8a99caec6f6cb12cde
Reviewed-on: https://pdfium-review.googlesource.com/12170
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
This is non recursive replacement for CPDF_DataAvail::AreObjectsAvailable.
Also added tests.
Change-Id: I546289fc0963d2343253755850f55af8c0bd8e4c
Reviewed-on: https://pdfium-review.googlesource.com/11430
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Make all pages dictionary are not inlined.
Original fix:
https://codereview.chromium.org/2491583002
Change-Id: Ie3aa662182a70ef6ef1d6121c0576c171e0060dd
Reviewed-on: https://pdfium-review.googlesource.com/11810
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Forbid C++14 encroachment.
Add big-endian caveat.
Change-Id: I1059d3b23ada2d7db1b30ecf8a7c75b0f94e6b58
Reviewed-on: https://pdfium-review.googlesource.com/12311
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: If2a8e608498c505440405e7eff675969ac4b195a
Reviewed-on: https://pdfium-review.googlesource.com/12330
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Instead of using CFX_FloatRect::ToFxRect(), which always rounds down,
use GetOuterRect() which correctly rounds up / down depending on the
side of the rectangle.
Change-Id: I7abd3a65e8c0467ed4303292f26a72737a5d553b
Reviewed-on: https://pdfium-review.googlesource.com/12312
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:752501
Change-Id: Ie9943cd80a4afa73ad9393c8bcd2aa2656a9d932
Reviewed-on: https://pdfium-review.googlesource.com/12290
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Add helper function for commonly used coordinates and give coordinates
used in tests semantic meaning.
Also add more sanity checks to make sure the commonly used coordinates
pass the FPDFPage_HasFormFieldAtPoint() hit test.
Change-Id: If116ed5323b49bdbcbd4d857b5184f9fcd4eb908
Reviewed-on: https://pdfium-review.googlesource.com/12070
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
For methods that are only exposed for testing. Once they are static,
there is no need for dummy CPDF_StreamContentParser constructor calls in
the unit tests. Adjust the CPDF_StreamContentParser constructor now that
one of the parameters can no longer be a nullptr.
Change-Id: If29b02ea216002a7bb325b1913281f58b70382aa
Reviewed-on: https://pdfium-review.googlesource.com/12230
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
FPDFFormFillInteractiveEmbeddertest subclasses know the type to expect.
Change-Id: I92c5fc75864330f5b1cbd392b9565b4323ce26b5
Reviewed-on: https://pdfium-review.googlesource.com/12052
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This removes a lot of repeated code that can go in SetUp()/TearDown().
This also makes the assumption that there is only 1 page used for
testing, so methods in the tests can refer to the page as a member
variable, rather than having a method parameter.
Change-Id: Ia77633ebe22f1184d2ee2fc78e88e7d33f48a86e
Reviewed-on: https://pdfium-review.googlesource.com/12051
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Use read validator to check trailer availability
Change-Id: Id8c62a6c746f136c05cfa8d646268322e2543b52
Reviewed-on: https://pdfium-review.googlesource.com/11770
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I042c5e843dcf535b2d6676d41c0037e87c59c219
Reviewed-on: https://pdfium-review.googlesource.com/12050
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Use read validator to check whole file availability.
Change-Id: Ic118ccee38557d124ecde3893ee3c18c98c674d5
Reviewed-on: https://pdfium-review.googlesource.com/11712
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I38ee7e59f4bf9587f43546460c87bb8539121472
Reviewed-on: https://pdfium-review.googlesource.com/12211
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Use read validator to check cross ref table availability
Change-Id: I050c366a255598ca6d8bcd353afa94c4a09c33a9
Reviewed-on: https://pdfium-review.googlesource.com/11730
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Added FPDFAnnot_GetAnnotIndex() to get the index of an annotation. This
is useful if linked annotations are renedered together - then we need to
know which ones in the annotation list we need to skip.
Bug=pdfium:863,pdfium:737
Change-Id: I53482a15e0fd9a896b348b64d68e99f9c21da9f9
Reviewed-on: https://pdfium-review.googlesource.com/11970
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Avoid pushing nullptrs into the orphans list.
Change-Id: I2d52c83e6f20e89be101365d3cca0960b4941a4f
Reviewed-on: https://pdfium-review.googlesource.com/12190
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
CFX_Point and CFX_PointF are derived from CFX_PTemplate.
Add a helper function to replace the rarely used method where its used.
Change-Id: I28448d44bbae9aa6773d1ad5fd7daf342b67c84c
Reviewed-on: https://pdfium-review.googlesource.com/12071
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Currently these use -1 as a special value to indicate not set. This
creates the same issues that FX_STRNPOS created for converting
FX_STRSIZE to size_t, so this code has been rewritten.
BUG=pdfium:828
Change-Id: Iaaa96af0dcb2eb8b600f3ea39060a398ac9a3800
Reviewed-on: https://pdfium-review.googlesource.com/12130
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Remove some useless overrides.
Change-Id: Icf4d8bfcca6358ef3f59f768c2d60759d4b05243
Reviewed-on: https://pdfium-review.googlesource.com/10854
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Refactor identical code used in decode_Template0_unopt() into their own
methods.
Change-Id: I37348a280ecc66d91fdcd3c9aabe49d2a8065417
Reviewed-on: https://pdfium-review.googlesource.com/11950
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
ReplaceIndirectObjectIfHigherGeneration() deletes replaced objects, but
those objects may be in use. So move them to the orphans list instead to
avoid potential dangling pointers.
BUG=chromium:757705
Change-Id: Ide83a1b85b754166d298fd50e655ca331ba4f942
Reviewed-on: https://pdfium-review.googlesource.com/11670
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: If038850c745ac26e50c313bdbe630483434caedc
Reviewed-on: https://pdfium-review.googlesource.com/11390
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:749610
Change-Id: Ia83558568293398c72b7215e9b3fe4e4df6f969a
Reviewed-on: https://pdfium-review.googlesource.com/11931
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:738711
Change-Id: I4a308694c3e6fcd17431515b7897969d54486071
Reviewed-on: https://pdfium-review.googlesource.com/11870
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
BUG=chromium:749610.
Change-Id: I4de7855aec552e6c143e7a8be6b90e44945a0fcb
Reviewed-on: https://pdfium-review.googlesource.com/11930
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Merge CPDF_SyntaxParser::GetObject and CPDF_SyntaxParser::GetObjectForStrict.
Change-Id: Ic9ff51e24ee981c268239847e3cca1c6f6a6f269
Reviewed-on: https://pdfium-review.googlesource.com/10511
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL creates a global font loader for use in XFA tests. This is
needed because the CFGAS_FontMangaer takes a linearly increasing amount
of time to load fonts each time it's loaded. This can get excessively
slow for test suites which run a lot of tests.
Change-Id: Ie389844b56598ce414f4f761654fa4ed465955fd
Reviewed-on: https://pdfium-review.googlesource.com/12090
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This code will just add 0 to x and subtract 0 from y. Doing nothing.
Remove.
Change-Id: I6e0aa91d088acd49cb83d4bded29908b544b692b
Reviewed-on: https://pdfium-review.googlesource.com/12110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: 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>
|
|
In this CL, the flag CMS_DONT_USE_FAST_FLOOR is set to true because quickfloor
could cause heap-buffer-overflow due to flooring errors. In the testcase for
the bug, Input[2] is a number very close but smaller than 1 such that
quickfloor returned 1 (whereas Input[2] >= 1.0 was false).
Bug: chromium:752725
Change-Id: Ibb1763aa120a600e86602f1a46c4cd6d0d6bebd5
Reviewed-on: https://pdfium-review.googlesource.com/11310
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
|
|
Change-Id: Ia9738e14d90a813b6ec7abd72843248fd3a3bff0
Reviewed-on: https://pdfium-review.googlesource.com/11910
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
cherry-pick of https://github.com/glennrp/libpng/commit/92a7c79db2c962d04006b35e2603ba9d5ce75541
BUG=chromium:729673
Change-Id: I907b4920ed6d276a075a30269be1744aff678069
Reviewed-on: https://pdfium-review.googlesource.com/11690
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The crash was caused by a dangling pointer in CPWL_ListCtrl to
the font map owned by CFF_TextObject. The order of events was:
1. ~CFFL_ListBox runs and calls parent destructor ~CFFL_TextObject.
2. ~CFFL_TextObject runs and deletes its member m_pFontMap. m_FontMap
was referenced by CPWL_ListCtrl which is now dangling.
3. ~CFFL_TextObject calls parent destructor ~CFFL_FormFiller.
4. ~CFFL_FormFiller calls DestroyWindows().
5. CFFL_FormFiller::DestroyWindows() deletes widgets, among them
CPWL_ListBox.
6. ~CPWL_ListBox deletes its member CPWL_ListCtrl.
7. ~CPWL_ListCtrl sees a dangling pointer to the map and crashes.
Making the DestroyWindows() call earlier in the destructor of
CFFL_TextObject, we execute steps 5-7 before freeing m_pFontMap.
An extra DestroyWindows() is still made in ~CFFL_FormFiller, but
it is then non-op if the derived CFFL_TextObject already called it.
Bug: chromium:757506
Change-Id: Ib8dce04f1dd0bcf8e10701f6cf7ea500bfb5ba84
Reviewed-on: https://pdfium-review.googlesource.com/11651
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The current limit of 2000 is still causing occassional ASAN issues,
reducing to 1250.
BUG=chromium:757711
Change-Id: Idb07f97b01230afabcceaa23b29495432193ec64
Reviewed-on: https://pdfium-review.googlesource.com/11750
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL updates the text edit engine to load and unload the page
directly instead of calling through the edit widget.
Change-Id: I636c8e8b0e635968222430098d3d268c75224b42
Reviewed-on: https://pdfium-review.googlesource.com/11590
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL cleans up the GetPre* methods in CFDE_TextEdtEngine. In
particular:
* GetPreDeleteText was inlined as it was very simple
* GetPreReplaceText was removed as unused
* GetPreInsertText was renamed to InsertIntoTextCopy to make clear
that this was doing the insert into a copy of the text.
Change-Id: Icde0126b6ddb0ec9d4956238ebff53c9fe51c051
Reviewed-on: https://pdfium-review.googlesource.com/11531
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Previously text break was a unique_ptr inside the CFDE_TxtEdtEngine.
This CL converts it to be a member instead of a unique_ptr. We never
replace the pointer after it's created.
Change-Id: I89ab73e81c63c24abfacd38a1141db6473d77640
Reviewed-on: https://pdfium-review.googlesource.com/11530
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@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>
|
|
This CL converts the return value to be an enum class and updates the
usages to use the names instead of values.
Change-Id: I8b6927551679ac4103775a04187daad2e0d6c569
Reviewed-on: https://pdfium-review.googlesource.com/11512
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Ie1fa04cdcdd426cf76413e7e5fe714ba7922458c
Reviewed-on: https://pdfium-review.googlesource.com/11713
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Use read validator to check "startxref" availability.
Change-Id: I258a707e4269fe768898d74db0955302b34ccf34
Reviewed-on: https://pdfium-review.googlesource.com/11711
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Use read validator to check header availability.
Change-Id: Ib482347cb2f112e27a6bcc4e8da865d0ecf1a630
Reviewed-on: https://pdfium-review.googlesource.com/11710
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Do not store non main trailers in memory.
Improve readability.
Change-Id: I2eab5d31a5be056871e7e5953e4b38662b91f5ae
Reviewed-on: https://pdfium-review.googlesource.com/10750
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The ::AddImage call can return a nullptr if there is no stream provided.
This CL adds the missing null check on the returned object when lookikng
at the image.
Bug: chromium:756418, chromium:753700
Change-Id: I48032c0f421c8889827540ae91f404ef0f503bfe
Reviewed-on: https://pdfium-review.googlesource.com/11532
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This was pulled in via DEPS to make the Skia build work, but it no
longer appears to be needed.
Change-Id: Ib83aa56cd08f1a0abcc0388ce881ec35c41788be
Reviewed-on: https://pdfium-review.googlesource.com/11333
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
The previous behaviour of [] on an empty string was to return 0
regardless of the index. We wanted to make this more strict, hence the
current behaviour. This has led to a number of crashes due to code
depending on the old behaviour. Reverting to the old behaviour until
we have time to correct the call sites using empty strings.
Bug=chromium:752480, pdfium:828
Change-Id: I511eea4148de85bf7f4694351e7a030b1a37f0de
Reviewed-on: https://pdfium-review.googlesource.com/11630
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Currently, if FPDF_LoadDocument() is called on a nonexistent file, the
returned FPDF_DOCUMENT will be null, but FPDF_GetLastError() will return
an error of FPDF_ERR_SUCCESS, i.e. no error.
This CL corrects this behavior by updating the error to be FPDF_ERR_FILE
when the file doesn't exist.
Bug=pdfium:452
Change-Id: I3c3ec3a64e049636ddfb2ba5cb5f2745a0e19b6b
Reviewed-on: https://pdfium-review.googlesource.com/11650
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
|