summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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>
2017-09-08Store raw json with run results when running safetynet_job.py.Henrique Nakashima
Storing the machine-readable data is a good idea in general, in this case allowing us to create graphs with the historical runs. The json now also contains: - a version number in case there are future changes in the format - the date and time when the run started - which profiler was used - which commits were being compared - whether a comparison was run or not, that is, if the commit hashes for before and after differ Change-Id: I2913beaef30b90669ac4ffe60a656d4b69030588 Reviewed-on: https://pdfium-review.googlesource.com/13370 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-09-07Use std::move so this code compiles properly using gcc.chromium/3210chromium/3209Andrew Weintraub
R=dsinclair@chromium.org Bug: Change-Id: I34f9498f4e5942c5b10ab2848509de935882321d Reviewed-on: https://pdfium-review.googlesource.com/13470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-07Implement CPDF_SyntaxParser::PeekNextWord.Artem Strygin
Change-Id: I92c0bd417d9c5be59c36401efae89406e482756a Reviewed-on: https://pdfium-review.googlesource.com/12650 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-07Simplify CPDF_SyntaxParser::GetNextWordInternal.Artem Strygin
Use CPDF_SyntaxParser::ToNextWord to move position on word start. Change-Id: I6b63efc9027b2a4eb4749561bf8ce2b95527d03b Reviewed-on: https://pdfium-review.googlesource.com/12830 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-07Roll DEPS for build to 34f9a2b.Lei Zhang
Also do a long overdue roll for catapult to 0cf3924 which is needed by the build/ changes. Change-Id: I3ccaba251f4d68c90fe0fcb3c9637a72e964bfbd Reviewed-on: https://pdfium-review.googlesource.com/13410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-07Roll DEPS for build to a049c43.Lei Zhang
This enables MSVC by default on Windows again, so fix code that fail to build with MSVC too. Change-Id: I03fb4e3697ad777a4dca88af462b35526d6c1d4d Reviewed-on: https://pdfium-review.googlesource.com/13392 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-06Unify checksum calculation of EAN-8 and EAN-13.Henrique Nakashima
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>
2017-09-06Adding in missed )Ryan Harrison
BUG=pdfium:828 Change-Id: Ifeaf19291ffd33aab63449ab52f8d2606b66c0fc Reviewed-on: https://pdfium-review.googlesource.com/13330 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-06Fix issue with integer types on win32 in std::minRyan Harrison
DEPS roll is failing since std::min(size_t, int) -> int doesn't make sense. min is templated on a single class, i.e. std::min(size_t, size_t) -> size_t. BUG=pdfium:828 Change-Id: Idec3ac7bdbf1d22b8c878a95bd9c44c9a94bbccf Reviewed-on: https://pdfium-review.googlesource.com/13310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-06Merge CFX_WordBreak into CFDE_TextEditEngine::Iterator.Dan Sinclair
This CL moves the CFX_WordBreak::FindNextBreakPos into the text edit engine iterator. The word break data was moved to cfde_wordbreak_data. Change-Id: Ie022f5f761479f97b9d4bc7789f890cb2ef99106 Reviewed-on: https://pdfium-review.googlesource.com/13250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Implement word selection in CFDE_TextEditEngineDan Sinclair
This CL implements the needed logic in CFDE_TextEditEngine to handle word selection. Change-Id: I6b388c23655037fec107d68ec07d33638b959374 Reviewed-on: https://pdfium-review.googlesource.com/13211 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Add unit tests for UPC-A barcode writer.Henrique Nakashima
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>
2017-09-06Convert FX_STRSIZE int->size_tRyan Harrison
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>
2017-09-06GUID cleanupDan Sinclair
This CL removes fx_guid and inlines into CXFA_FM2JSContext as needed. Change-Id: I08a1f03fd4be46730eee24ab73b8b5c0daf9cd7d Reviewed-on: https://pdfium-review.googlesource.com/13094 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-06Remove unused CFX_WordBreak::Next methodchromium/3208Dan Sinclair
CFX_WordBreak::Next is never called, removed. This was the only method to pass a different value for the bFromNext param for FindNextBreakPos() so that param was also removed. Change-Id: I14ca0dc65490ec64209ba0b872794f75b3e3104f Reviewed-on: https://pdfium-review.googlesource.com/13210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Add unit tests for Codabar barcode writer.chromium/3207Henrique Nakashima
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>
2017-09-05Add unit tests for Code 39 barcode writer.Henrique Nakashima
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>
2017-09-05Rename fx_rand to fx_randomDan Sinclair
Match FX_Random method names. Change-Id: I2d178229563881479b80e1f86975f5b165475837 Reviewed-on: https://pdfium-review.googlesource.com/13093 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Remove isDevice parameter from barcode Render().Henrique Nakashima
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>
2017-09-05Cleanup CFX_WordBreakDan Sinclair
Remove unused GetWord, make methods only used in the class private. Change-Id: Ia5b63da7f9dc3a918380742213d98f9d1b3651a3 Reviewed-on: https://pdfium-review.googlesource.com/13092 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Remove redundant code.Artem Strygin
Do not check recursive parsing of same object in CPDF_SyntaxParser, because this problem is solved in CPDF_IndirectObjectHolder. (See https://pdfium-review.googlesource.com/c/pdfium/+/12590) Change-Id: I7829e06ae5eb06e85a0c8cfe22c1c428b55bb692 Reviewed-on: https://pdfium-review.googlesource.com/12610 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-05Remove unused CFX_CharIter classDan Sinclair
The CFX_CharIter class was only used in a single Attach call of CFX_WordBreak which is never called. Removed. Change-Id: I8262cbb25d341b976ab85095250357fecba48fbc Reviewed-on: https://pdfium-review.googlesource.com/13091 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Leave space for null characters when getting textRyan Harrison
The conversion from WideString to ByeString adds in null characters at the end, so we need to account for these when selecting the range of text to initially extract. BUG=chromium:761770,chromium:761626 Change-Id: Ib8f863e997ebccaaf882e0beb29733f27a18826d Reviewed-on: https://pdfium-review.googlesource.com/13110 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-05Split fx_guid from fx_extensionDan Sinclair
This CL splits the GUID code out of fx_extension into an fx_guid.h file. Change-Id: I915538ff98601efb07595264eff6435729193177 Reviewed-on: https://pdfium-review.googlesource.com/13090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Split random code from fx_extension.hDan Sinclair
This CL moves the code invovled in random number generation into fx_rand.h from fx_extension.h. Change-Id: I6c644d7ec0323f32ef6e23c2e2548a9c792e3a72 Reviewed-on: https://pdfium-review.googlesource.com/13070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Fix length field in dictionary on create streamArtem Strygin
The CPDF_stream constructors were not setting the "Length" into the stream dictionary. The "Length" was being set by the SetData methods. This CL fixes the constructor to properly set the "Length" field. Change-Id: Iee1bd7f7a096d415ab01ee3d2f3416e19e87ece9 Reviewed-on: https://pdfium-review.googlesource.com/13010 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-05Refactoring of CPDF_IndirectObjectHolder.Artem Strygin
CPDF_IndirectObjectHolder is optimized. Recursively parsing of same object has been fixed. Change-Id: I22e5cfd6b03eee0677f2b1f8ba32bf29cad441fc Reviewed-on: https://pdfium-review.googlesource.com/12590 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-05Move Parsing of indirect object logic into CPDF_SyntaxParser.Artem Strygin
Change-Id: I5473d6db3e6fc247d52a83b34424958dc20387f4 Reviewed-on: https://pdfium-review.googlesource.com/12150 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-05Upgrade OpenJPEG to 2.2.0Nicolas Pena
This CL upgrades OpenJPEG by copying the files from 2.2.0 and then applying patches. Patch files that are no longer relevant are deleted. The relevant ones are applied manually due to changes in formatting in OpenJPEG. Patch 34 is added to account for opj_malloc changes in PDFium. Bug: chromium:718731 Change-Id: I3d316893eab5e235c9f71222a6818b8ae0c98383 Reviewed-on: https://pdfium-review.googlesource.com/12770 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-05Split fx_ucd.h into fx_unicode.h and fx_ucddata.h.Tom Sepez
File naming now matches. Fix one usage not going through the accessor function. Change-Id: I5cc4986238764964f2a71807a94bd2facf517263 Reviewed-on: https://pdfium-review.googlesource.com/12930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-01Add unit tests for EAN-8 barcode writer.chromium/3204Henrique Nakashima
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>
2017-09-01Fix EAN-13 checksum and add unit tests.Henrique Nakashima
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>
2017-09-01Cleanup usages of Mid(foo, 1), Right(1), and Left(1)chromium/3203Ryan Harrison
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>
2017-09-01Prepare for converting FX_STRSIZE int->size_tRyan Harrison
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>
2017-09-01Fix integer overflow in Buffer_itoa when passing INT_MIN.Henrique Nakashima
Bug: chromium:760034 Change-Id: Id0862749b1454e065de4de7d746a27e78ac58e30 Reviewed-on: https://pdfium-review.googlesource.com/12730 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-01Adjust loops in preperation for FX_STRSIZE int->size_tRyan Harrison
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>
2017-08-31Remove unused FXFORMAT_HEX and FXFORMAT_CAPITAL.Henrique Nakashima
Change-Id: I13140ea4242db4b0860f8fdd164f50d1745c0794 Reviewed-on: https://pdfium-review.googlesource.com/12790 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Rename fxcrt_ and ifxcrt_ files to better namesDan Sinclair
The CFXCRT and IFXCRT prefix was only used on 3 files. This CL renames them to the more common CFX and IFX. The files were renamed as needed. Change-Id: Iccdaa55c5822adb93af7c58aedfb121413a30223 Reviewed-on: https://pdfium-review.googlesource.com/12675 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Make FPDF_GetText stricter on inputsRyan Harrison
The current implementation of this function is problematic. It will attempt to memcpy to NULL. It will accept obviously wrong inputs like a negative start index. It will also accept -1 for the count, which in theory is the amount of space the buffer has allocated to it, so doesn't make sense, but instead an internal call will calculate the number of characters to get if the count is -1. This will them lead to the function attempting to call Left(-1) on a string, which is invalid. Ths documentation for this function mentions none of this behaviour, so I am removing it, since it is inconsistent/bad. The implementation should now more strictly meet defined API. BUG=pdfium:828 Change-Id: I18afdb33e12d77c10d856b4bacd615481979c484 Reviewed-on: https://pdfium-review.googlesource.com/12733 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Change FPDFImageObj_GetImageFilter() to return byte strings.Lei Zhang
Since the returned data is a key, it should be a byte string and not a wide string. Change-Id: I9243d88586ea5b13c4b6556479d17316bf07e32e Reviewed-on: https://pdfium-review.googlesource.com/12710 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-31Move implementations into fx_system.cppDan Sinclair
This CL moves code defined in fx_system.h to be implemented in fx_system.cpp. Change-Id: I0c19066d4497bd208f4560fdcaf57cf04bf9f146 Reviewed-on: https://pdfium-review.googlesource.com/12674 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move fx_extension implementation to cpp fileDan Sinclair
This CL moves the GetBits32 implemenation into fx_extension.cpp. It also moves some of the fx_basic unittests to the correct unittest files. Change-Id: I2cf8657c228375508db0f02baa628d62a3b2ab25 Reviewed-on: https://pdfium-review.googlesource.com/12673 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move stream code into fx_stream.cppDan Sinclair
This CL moves methods defined in fx_stream.h into the fx_stream.cpp file. Change-Id: I32147d18dd7f4a29c228f11d108ac01cb891b290 Reviewed-on: https://pdfium-review.googlesource.com/12672 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>