summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-09-19Remove unneeded core/fxcodec/fx_codec.h includes.chromium/3220Lei Zhang
Change-Id: I703321108712e8c4a11a8343ecf8b1a8804c1d1a Reviewed-on: https://pdfium-review.googlesource.com/14352 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-19Default to c++11 instead of c++14.Lei Zhang
PDFium has users that may not be ready for C++14 yet. Change-Id: I99de1c8126fd94ac728653262c05e5d26b1734f3 Reviewed-on: https://pdfium-review.googlesource.com/14351 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-19Setting focus on a widget may destroy the widgetDan Sinclair
When a widget has focus set, this can trigger an Invalidation call which can trigger a page and annotation reload. This reload can destroy the current widget we're handling. This CL adds ObservedPtrs as needed so we can make sure the widgets are still alive after we've done the Invalidation. Bug: chromium:765921 Change-Id: I51cd24aa1ebd96abe9478efef5130a4e568dac1a Reviewed-on: https://pdfium-review.googlesource.com/14290 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-19Remove unused methods and field in CFFL_FormFiller.Henrique Nakashima
Change-Id: Ice5ef31af6e32b6a02072e2a4445b19d4f801d3c Reviewed-on: https://pdfium-review.googlesource.com/14330 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-09-19Roll DEPS for build to fc826e6.Lei Zhang
Change-Id: Ic7a1f8fd415526d198bc32469e9b191eac6df4bf Reviewed-on: https://pdfium-review.googlesource.com/14250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-19Cleanup FindNextBreakPos variablesDan Sinclair
The ePreType flag is only used if bFirst is true. After the first iteration of the loop bFirst is always false. This CL removes the updating of ePreType as it will never be used. Also bFirst is only set false at the end of the loop and the do {} while is changed into a while {} Change-Id: Iaced1b38bddcc6f5483ae20993ac69c93b2e3f97 Reviewed-on: https://pdfium-review.googlesource.com/14292 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-19Invert flag to CFDE_TextEditEngine::Iterator::IsEOFDan Sinclair
This CL changes the IsEOF flag to match the semantics of the FindNextBreakPos flag. Change-Id: I1a8aba91171baeacf80bdea4b9468d6093599c90 Reviewed-on: https://pdfium-review.googlesource.com/14291 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-19Convert selection to use count instead of end indexDan Sinclair
This CL changes the Text Edit Engine code to use a count instead of an end index for the selection range. Using count lets us differentiate a selection at the beginning of 1 character and an empty selection. A few new tests were added to test unicode word break behaviour, some are not working yet and are commented out. Change-Id: Icce8f5003102ef0a850151ccdf16d3c2226d94bf Reviewed-on: https://pdfium-review.googlesource.com/13491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-19IWYU: Explicitly include <stdint.h> in some headers.Raphael Kubo da Costa
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>
2017-09-19Use CPDF_ReadValidator to request linearized hint tables.Artem Strygin
Change-Id: I9ecf08c5cabfeb7b354abeb46b94918ae0b4539a Reviewed-on: https://pdfium-review.googlesource.com/13590 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-19Simplify CPDF_Parser::LoadCrossRefV4Artem Strygin
Change-Id: Ie1170e71fb2d8f87857e68620f27e478a0801d21 Reviewed-on: https://pdfium-review.googlesource.com/13670 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Use CPDF_ReadValidator to request linearized first page.Artem Strygin
Change-Id: I416e636d90c63679e2dd0b109c6594fc02663c89 Reviewed-on: https://pdfium-review.googlesource.com/13572 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Remove useless code.chromium/3219Artem Strygin
Change-Id: Idbde2714eb5a3fd5a76c77ce968f790f3c5dfa07 Reviewed-on: https://pdfium-review.googlesource.com/13571 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Use CPDF_ReadValidator to request linearized data.Artem Strygin
Change-Id: I5c0fccc74a9f103d91c95fd72dc6683d991eadec Reviewed-on: https://pdfium-review.googlesource.com/13570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Cleanup word break propertiesDan Sinclair
This CL attempts to clarify the contents of the gs_FX_WordBreak_Table and adds static_asserts that each entry in the WordBreakProperty table has the value we expect. Change-Id: I33c1f12a9e18240b01969be9902204eba5074eb7 Reviewed-on: https://pdfium-review.googlesource.com/13430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-18Remove some unused variables.Lei Zhang
BUG=chromium:760070 Change-Id: Icb2e46da86b6b7e71dae309a015ae1c5301fc931 Reviewed-on: https://pdfium-review.googlesource.com/14230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-18Convert string class namesRyan Harrison
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>
2017-09-18Roll DEPS for build to e659d43.Lei Zhang
Add third_party/eu-strip, which is now required to build on Android. Since third_party/eu-strip is small and rarely updated, just check in a copy. Change-Id: Iba016d8d69c8426f1dacbeeef36b30ca743c46f0 Reviewed-on: https://pdfium-review.googlesource.com/13411 Commit-Queue: (000 09-08 - 09-18) dsinclair <dsinclair@chromium.org> Reviewed-by: (000 09-08 - 09-18) dsinclair <dsinclair@chromium.org>
2017-09-15Use unsigned types for app age, value age in widgets.chromium/3218chromium/3217Tom Sepez
Then if they roll over, it doesn't matter, since we only check for change. And then we can pull a silly check. Then remove some no-op calls where we didn't use the result. Change-Id: I35ba470b42fb8c32a6984999e0311b21729791ca Reviewed-on: https://pdfium-review.googlesource.com/14210 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-15Introduce CPWL_Wnd::PrivateData class.Tom Sepez
First step in passing ownership of this memory to the CPWL_Wnd. In turn, nest two other classes that also require PrivateData to satisfy nesting rules. Move one stray #define to the appropriate file while at it. Change-Id: I565934565421f5843a3b792b3bdc21b5e8839eb8 Reviewed-on: https://pdfium-review.googlesource.com/14170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-15Move CPWL_CREATPARAM to CPWL_Wnd::CreateParamsTom Sepez
This nesting makes so much more sense when I read the code. Fix member naming for this in CPWL_Wnd. Pass in/out CreateParams arg as pointer. Kill Reset() method, only called during destroy and nothing needs explicit cleanup. Change-Id: If50e403e11c131e7656da09c0cb36866223d64c6 Reviewed-on: https://pdfium-review.googlesource.com/14070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-09-15Simplify a couple of CXFA_Node methods.Lei Zhang
Change-Id: I89c81e18273e929910f083399ed169017a6171f5 Reviewed-on: https://pdfium-review.googlesource.com/14091 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-15Add ObservedPtrs to KillFocus pathRyan Harrison
This is to prevent use after free issues due to these calls causing reloads of content that have the side of effect of destroying windows. BUG=chromium:760455 Change-Id: I3f3947be8b32964783abf5577a24ba6a713b3476 Reviewed-on: https://pdfium-review.googlesource.com/14150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-15Fix nullptr dereference in XFA_Node::SetScriptContent().Lei Zhang
BUG=chromium:763353 Change-Id: I6ee93f769509326d9af5bbfa1450c90747d6a065 Reviewed-on: https://pdfium-review.googlesource.com/14090 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-15Add public method FPDFPath_CountPoint to get # of points of a path object.Miklos Vajna
It was already possible to get the fill color, this exposes the number of points. Naming attempts to be consistent with existing FPDFPage_CountObject(). Change-Id: I79e8dd9f0c077de84ce9017a01d239e48e58174a Reviewed-on: https://pdfium-review.googlesource.com/13592 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-15Make static const char* arrays more const.Lei Zhang
Change-Id: I87b5e6cefe973b82b4868e56fc5285c95c53a12b Reviewed-on: https://pdfium-review.googlesource.com/12550 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-15OnBeforeKeystroke may invalidate the widget's window.Tom Sepez
And along with it any data that the window may have been carrying. Tidy some return codes while we're at it. Bug: 765384 Change-Id: Id16ec5f82b3d9273ba8f2edb1e4645a9145df4f6 Reviewed-on: https://pdfium-review.googlesource.com/14050 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-14Fix decoding of JBIG2 integers for values with large magnitude.Henrique Nakashima
Now considering anything not representable by a 32-bit signed int as OOB rather than decoding some arbitrary overflowed value. Bug: chromium:761666 Change-Id: I00f5a3abadca51f9bedc5e5d78f7f184040c2f33 Reviewed-on: https://pdfium-review.googlesource.com/14010 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-14Checkbox event fixed when triggered by a keyboard entryClaudio DeSouza
The event was changed to behave in the same way as when reacting to a mouse click event. R=thestig@chromium.org Bug: pdfium:897 Change-Id: I14366d69ad309e00cb1dd78672870d1ee95007a9 Reviewed-on: https://pdfium-review.googlesource.com/13990 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-14Add more FPDF_GetMetaText() tests.Lei Zhang
Change-Id: I27d26691a3b7bd8593581483d4a21729040fbe95 Reviewed-on: https://pdfium-review.googlesource.com/13910 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-14Add tests for FPDF_GetMetaText().Lei Zhang
Change-Id: I8d2eaea9696b6ac4ea7ba5cb323bf74546c31d46 Reviewed-on: https://pdfium-review.googlesource.com/13890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-14Move test/ to testing/resources/xfa/Lei Zhang
This is a directory with manual XFA tests from several years ago. Change-Id: I0c104a99e877ed90095a8a3fa4ad4a9c78323c64 Reviewed-on: https://pdfium-review.googlesource.com/13870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-14Roll clang to 4db5854chromium/3216Tom Sepez
AKA roll clang 310694:312679 Fix virtual dtor warning in xfa/fde/cfde_texteditengine.h Bug: pdfium:896 Change-Id: Ib5fb9433b2c138ca46ccb281b8c0a852daeb623e Reviewed-on: https://pdfium-review.googlesource.com/13850 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-14Revert moving JPX library decode from Init to DecodeRyan Harrison
Due to some of the size parameters for allocating space in Decode() depending on the values produced by opj_decode(), this change was causing misallocation of space, which in turn was causing illegal reads/writes. The issue with excessive memory usage that the original CL was trying to change is less significant than the above mentioned problems, so reverting this fix and looking for another solution to the problem. This will re-open bugs https://crbug.com/754423 and https://crbug.com/761005. BUG=chromium:764177,chromium:754423,chromium:761005 Change-Id: I1cafac8a8117ec1e3bc32b31196bdec719d46477 Reviewed-on: https://pdfium-review.googlesource.com/13950 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-14Fix CPDFPathObjectFromFPDFPageObject() implementation.Lei Zhang
It should make sure the FPDF_PAGEOJECT passed in is actually a path. Change-Id: I89d0626dc350fd2f65b08282b276a4de2c3a7398 Reviewed-on: https://pdfium-review.googlesource.com/13710 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-13Change behaviour of FPDF_RenderPageBitmapWithMatrixNicolas Pena
This CL changes the behavior of FPDF_RenderPageBitmapWithMatrix so it transforms the bitmap. Before, the page would be transformed and the assumption was that it would be drawn on a bitmap with the same dimensions as the original page. This does not work well because a transformation generally changes the dimensions of the page. The rectangles test is modified to include small rectangles in the corner of the page, so that it's clear that the whole original page is being displayed. Bug: pdfium:849 Change-Id: Ie89f959a1605fea59a15d239ca871ccd939ec92b Reviewed-on: https://pdfium-review.googlesource.com/13510 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-13Remove includes of xfa/fwl/theme/cfwl_widgettp.h that are unused.Henrique Nakashima
Change-Id: I51fb7b9df8bdb557e9dca6d1be91736fe124e16a Reviewed-on: https://pdfium-review.googlesource.com/13630 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-09-13Add reverse iterators to CFX String classes.Tom Sepez
Reverse iteration with signed lengths and indices is kinda icky without this abstraction, and STL provides this pretty much "for free" given the existing forward iterator. Change-Id: I97c36c8bd23c0aa48195bc17da7c672292b4cde2 Reviewed-on: https://pdfium-review.googlesource.com/13770 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-09-13Add readme files to some directories.chromium/3215Henrique Nakashima
Change-Id: I2a750c8e46b68dc4870e2dadd2ed3429008e1562 Reviewed-on: https://pdfium-review.googlesource.com/13551 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-13Rewrite IsHyphen using string operationsRyan Harrison
The existing code did end of range checks by making sure that the value was never less then 0. This isn't correct when using an unsigned type, since 0 - 1 will wrap around to the max possible value, and thus still be less then 0. Additionally the existing code was hard to follow due to the complexity of some of the low level operations being performed. It has been rewritten using higher level string operations to make it clearer and correct. BUG=chromium:763256 Change-Id: Ib8bf5ca0e29e73724c4a1c4781362e8a8fc30149 Reviewed-on: https://pdfium-review.googlesource.com/13690 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-13Avoid double va_list traversal in CFX_WideString::FormatVTom Sepez
Speculative fix for bug. Also remove FX_VA_COPY as va_copy should be fine on all ports nowdays (we think). Bug: 763965 Change-Id: I5c321d5624d00b3b2f262ec599e4382f02b744ff Reviewed-on: https://pdfium-review.googlesource.com/13790 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-12Don't attempt to decrypt AES streams that are too shortchromium/3214Ryan Harrison
When reading a stream, if it is encrypted using an AES cipher it must be atleast 16 bytes long aka 128 bits, other wise it is malformed. BUG=chromium:763585 Change-Id: Ied7c36978f1eb24aeda93a184527b6d6a191e5c3 Reviewed-on: https://pdfium-review.googlesource.com/13751 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-12Remove ASSERT that was added to understand what was occuringRyan Harrison
thestig provided a test PDF that reproduced the issue that is being tested for in the ASSERT. I have spent some time going throught the related code, and the condition in the assert is actually standard behaviour, so shouldn't be asserted. The following code gracefully handles the case of more text then requested being returned. BUG=chromium:763369 Change-Id: I5bc121977169deead52fc5dd2503376b1b62d83f Reviewed-on: https://pdfium-review.googlesource.com/13750 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-11Address nits missed from original reviewchromium/3213Ryan Harrison
BUG=chromium:761005 Change-Id: I538e49f1eeb32891b33677d8587d2bed110b1fc1 Reviewed-on: https://pdfium-review.googlesource.com/13692 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-11Add guard against reading more then expected from the pageRyan Harrison
This really shouldn't ever happen, but there used to be this guard in this code and I am getting reports of crashes after it was removed. I have added an assert, so hopefully if it is actually occuring, then we might get a reproduction case based on a debug build crash. BUG=chromium:763369 Change-Id: Ifaebfbcb0413a1d7777222ba838aaee234f94ae3 Reviewed-on: https://pdfium-review.googlesource.com/13691 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-11Use the right allocate and free functions in OpenJPEG.Chris Palmer
This patch was authored by Ke Liu of Tencent's Xuanwu Lab. BUG=762374 Change-Id: Icb3ee98fb4c399b871ccf11e9920af7caf51be11 Reviewed-on: https://pdfium-review.googlesource.com/13610 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
2017-09-08Fix an off by 1 error in TIFF_PredictLine().chromium/3212Lei Zhang
BUG=chromium:762106 Change-Id: I714d69320cc4fb81d535f811c18d4ef91fec44d3 Reviewed-on: https://pdfium-review.googlesource.com/13212 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-08Remove CFWL_SpinButton, which is unused.chromium/3211Henrique Nakashima
Change-Id: I0be113b5515a95829566938c84e2f74c7c1c75a3 Reviewed-on: https://pdfium-review.googlesource.com/13552 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-09-08Fix one-second spin in fx_random.cppTom Sepez
Take seed generation logic from base's address_space_randomization.cc. One small tweak is to avoid the bottom three bits of a stack address and invert, to make leaking ASLR more difficult along the lines of the freelist masking in base's partition allocator. Another tweak is to mix in some more time-based information. Another tweak is to add in the times called so that rapid successive calls return different results. Bug: pdfium:891 Change-Id: I14238da15cee9c8d4ca72d79e4f7fbb26997c619 Reviewed-on: https://pdfium-review.googlesource.com/13490 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-09-08Move decompressing of JPX out of Init and into DecodeRyan Harrison
In the existing implementation of the JPX decoder, Init extracts the header from the image and then immediately decompresses it. This is problematic if it is a very large image that we won't be able to allocate a bitmap for. The code has been changed to instead delay decompression until the Decode method, since things like dest Bitmap generation can be performed using just the header information. There is also a bit of renaming/casting cleanup, because I was having a hard time parsing what was a local vs member variable. BUG=chromium:761005 Change-Id: I55a55c0be2f88a5352a6ca056c2a816137d7c749 Reviewed-on: https://pdfium-review.googlesource.com/13550 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>