summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-07-30Remove a NOTREACHED() in FormValueNode_SetChildContent().Lei Zhang
It is reachable, and the action is currently a no-op, so let it be. Also change FormValueNode_SetChildContent() to return void since no caller checks the return value. Remove its default argument, since all the callers set it. Change-Id: I742ca2d936872a3b3d609c178321199abc06546c Reviewed-on: https://pdfium-review.googlesource.com/39115 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-30Remove CFGAS_PDFFontMgr::m_FDE2PDFFont font cache.Henrique Nakashima
This cache is never read. Change-Id: Iaa4dcf8debf01ab783c2e757a19b18c0317d6fe1 Reviewed-on: https://pdfium-review.googlesource.com/39150 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-30Check maximum bit count of shared group object numbers.Artem Strygin
Bug: chromium:868477 Change-Id: I5957c5ef051bc4fa8eb51efa6a7fc142996742c5 Reviewed-on: https://pdfium-review.googlesource.com/39130 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-28Remove CXFA_TraverseStrategy_ContentLayoutItem.chromium/3507chromium/3506Tom Sepez
It makes illegal casts and requires its callers to double-check the type validity of results before use. Instead, use the parent class iterator and perform checked casts. No functional difference, since it looks like the requisite checks were being made in all places. Make one "using" visible to other files to save some verbosity. Change-Id: I894ca15b4bdddd4723b787663950a58bc58b7f06 Reviewed-on: https://pdfium-review.googlesource.com/39030 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-28Add CPDSDK_Annot::AsBAAnnot() checked downcast methodTom Sepez
XFA introduces some additional subclasses, so it doesn't hurt to be sure in all cases before making a static cast. Change-Id: I7447ca58be0b57201b39ba40a3fc5f47505cee58 Reviewed-on: https://pdfium-review.googlesource.com/39013 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-28Add ToXML{Instruction,Text,CharData}() checked conversion functionsTom Sepez
All usages were previously checked correctly, but this consolidates some code as well. Change-Id: I63711748b31b698a3f21f98fdb536db1e9e0b1cf Reviewed-on: https://pdfium-review.googlesource.com/39010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-27Roll DEPS for testing corpus to 4e2bafc0.Lei Zhang
https://pdfium.googlesource.com/pdfium_tests/+log/48945a35..4e2bafc0 TBR=hnakashima@chromium.org BUG=chromium:828177 Change-Id: I79908a09396798ff60b7aab0bccaa1c7574acaab Reviewed-on: https://pdfium-review.googlesource.com/39011 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-27Make pixel_tests pass on Windows 10.Lei Zhang
BUG=chromium:828177 NOTRY=true Change-Id: I94de26cf74b27b7c71795a2ee189c9c6b4c56ac6 Reviewed-on: https://pdfium-review.googlesource.com/38903 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-27Make pdfium_embeddertests pass on Windows 10.Lei Zhang
BUG=chromium:828177 NOTRY=true Change-Id: I30123087bbe11aaaa6175b5f729b7ab55107a975 Reviewed-on: https://pdfium-review.googlesource.com/38902 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-07-27[cq.cfg] Flip CQ to LUCIRyan Tseng
Bug: 860896 Change-Id: I0220f3f46619ee0eac054b39938da053a7a16dec Reviewed-on: https://pdfium-review.googlesource.com/39014 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Tseng <hinoka@google.com>
2018-07-27Tag XFA data bound to V8 Objects.Tom Sepez
Because we don't want to trust anything V8 gives us back. Use a deep namespace so we can have a short declaration in the structs, but avoid collisions. Change-Id: Ibb832a5dcd34c652159c3343dd70c9e2ee561537 Reviewed-on: https://pdfium-review.googlesource.com/38972 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-27Merge several methods into JBig2GrdProc::DecodeArithTemplateUnoptchromium/3505Nicolas Pena
This CL merges DecodeArithTemplateXUnopt for X=0,1,2. This is similar to how three methods were merged into DecodeArithOpt3. Change-Id: Ib0d4f14de6a8c924517d82eaec7577961503a325 Reviewed-on: https://pdfium-review.googlesource.com/38935 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-27Fix some nits in FPDFEditEmbeddertest.Lei Zhang
Change-Id: I435ced292df79118fb65dd2922292ed29824dc1c Reviewed-on: https://pdfium-review.googlesource.com/38970 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-27Parse obj nums range within Hint tables for shared groups.Artem Strygin
Change-Id: Ib22db6c57d2066ef70c0ef12e44d1e5eee6611a5 Reviewed-on: https://pdfium-review.googlesource.com/36410 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-27Roll DEPS for testing corpus to 48945a35.Lei Zhang
https://pdfium.googlesource.com/pdfium_tests/+log/d2389ab3..48945a35 TBR=hnakashima@chromium.org Change-Id: Idd52b14d473a9384536feb25426929b6435894ef Reviewed-on: https://pdfium-review.googlesource.com/38990 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-26Use moar ToXMLElement() in place of static_cast<>.Tom Sepez
Introduces checks in a few new places, but mainly just consolidates checking/casting logic. Change-Id: I634a03060d254db099972c6978249992367e146c Reviewed-on: https://pdfium-review.googlesource.com/38900 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-26Roll DEPS for testing corpus to d2389ab3.Lei Zhang
https://pdfium.googlesource.com/pdfium_tests/+log/9b7ff5b8..d2389ab3 TBR=art-snake@yandex-team.ru Change-Id: I5a7ce225dc1044aaf5a42d25d5a211057ef5732d Reviewed-on: https://pdfium-review.googlesource.com/38931 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-26Be more careful casting to widget subclasses.Tom Sepez
Part of the effort to reduce unchecked static casts. Change-Id: I1bff1c53aa7c5804660de4b65cf01523d70fcbb7 Reviewed-on: https://pdfium-review.googlesource.com/38896 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-26Remove font cache from CFGAS_DefaultFontManager.chromium/3504Henrique Nakashima
The cache is never accessed and retains fonts in memory that will not be used anymore. Change-Id: Ia763499dc88a99741a85afc4ddd09257e8e1119c Reviewed-on: https://pdfium-review.googlesource.com/38898 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-26Fix usage of deprecated V8 Value::ToString methodDan Elphick
Value::ToString is deprecated since the Isolate is inferred from the memory address of the object being converted to a string which will soon not be reliable. As such this method will be removed in the very near future. Change-Id: I1e5a1a0464f2052cc3aa5eeb1ddbdb7b0a9222d3 Reviewed-on: https://pdfium-review.googlesource.com/38914 Commit-Queue: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
2018-07-25Add vpython fileRyan Tseng
This is required in LUCI because python packages on LUCI are hermetically defined, and pywin32 is required for ninja. Bug: 860896 Change-Id: I37b5e8c1016d2f6bce2ad3638662b81e613b0d25 Reviewed-on: https://pdfium-review.googlesource.com/38901 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Tseng <hinoka@google.com>
2018-07-25Remove some ASSERT (and cast) in favor of checked cases.Tom Sepez
Because it is a stronger pattern at runtime. These were found by essentially: grep -ni '\bassert\b.*type' Change-Id: I913d77139053e8980528597a6633e1859e5204c4 Reviewed-on: https://pdfium-review.googlesource.com/38890 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-25Use incomplete type CFX_BmpContext in place of void*chromium/3503Tom Sepez
Allows killing off static_cast<> in two places. Change-Id: I467b69d92e8cbda5c2916b6ed2e97c173d8b4f2f Reviewed-on: https://pdfium-review.googlesource.com/38897 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-25Change GetHeaderOffset() to return Optional<FX_FILESIZE>.Lei Zhang
Remove |kInvalidHeaderOffset|. Change-Id: I5978e745e97aa4e13299dd21028721725ac0c996 Reviewed-on: https://pdfium-review.googlesource.com/38853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Art Snake <art-snake@yandex-team.ru>
2018-07-25Create popup with Contents only for same annotations subtypes.Henrique Nakashima
The subtypes are listed in "PDF Reference 1.7", page 617. Bug: chromium:856331 Change-Id: I41d6094949ff22007a72ef7c1493c413c5af5f7b Reviewed-on: https://pdfium-review.googlesource.com/38790 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-25Remove CFX_MemoryStream uses in tests.Lei Zhang
Replace with CFX_BufferSeekableReadStream, which allows for spans and const inputs. Change CXFA_DocumentParser to take IFX_SeekableReadStream instead of IFX_SeekableStream in the process. Change-Id: I0168451350c9fc250231f0414c38738a4d86ca42 Reviewed-on: https://pdfium-review.googlesource.com/38852 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-25Use struct {Single,Range}Cmap in FPDFAPI_CIDFromCharCode().Tom Sepez
Clearer that just using indexing off of raw pointers, and makes the code more closely resemble other functions. Change-Id: I7cc8363b505e66120bc1c686bb23b2bdf8fc401f Reviewed-on: https://pdfium-review.googlesource.com/38894 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-25README.md: Update waterfall locationRyan Tseng
Bug: 860896 TBR: thestig Change-Id: I61208b951e3746dae363f91dc9eab2319378b48f Reviewed-on: https://pdfium-review.googlesource.com/38895 Reviewed-by: Ryan Tseng <hinoka@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Tseng <hinoka@google.com>
2018-07-25Change CFX_BufferSeekableReadStream to take a span.Lei Zhang
Change-Id: Ib9e20fdfc637b2ba0358586e23ad72454b0b8ad1 Reviewed-on: https://pdfium-review.googlesource.com/38851 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-25Only build cfx_fileaccess_windows.cpp on Windows.Lei Zhang
- Remove #if guards in the .cpp file and flip the #if guard in the header to produce an error when incorrectly included. - Do the same for cfx_fileaccess_posix.cpp. - Also remove forward declarations for win32 APIs. Change-Id: I81056ea6198d342e62744bd3240b3a28ac53d5c0 Reviewed-on: https://pdfium-review.googlesource.com/38410 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-25Move CPDF_SyntaxParser init methods into ctor.Lei Zhang
- CPDF_SyntaxParser can no longer be initialized multiple times. - Make the file length and header offset const. - Make the header offset type FX_FILESIZE consistently. - Simplify for the common case where the header offset is 0. Change-Id: I7138db1fbcec3b7578b0239b92fc1154fa4dc4ce Reviewed-on: https://pdfium-review.googlesource.com/38850 Reviewed-by: Art Snake <art-snake@yandex-team.ru> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-25Disable submit in XFA forms.Henrique Nakashima
Bug: chromium:842503 Change-Id: If411815d8324929f482e3cad0fda54f24d370c2a Reviewed-on: https://pdfium-review.googlesource.com/37830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-25Introduce ToXMLElement() checked downcast helper functionTom Sepez
And use it in place of ASSERT() that the type was correct. Since we can check it, doing so at runtime may help avoid type confusion, and we'll get a nice safe SEGV if the asserted condition ever fails. Change-Id: I46b65a4b70e819a670d7cad7966e0d100f0d9a63 Reviewed-on: https://pdfium-review.googlesource.com/38810 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-25Move CXFA_ThisProxy helper to CXFA_Object.Tom Sepez
Because the other helpers are declared here. Rename VariablesThis to ThisProxy in a few places; VariablesThis is a slightly different concept (see GetVariablesThis()). Then introduce helper for CXFA_List subclass as well. Remove unused const version of some helpers. Change-Id: Ia328d8cd170a8b97015e98c1c770fa8a44810455 Reviewed-on: https://pdfium-review.googlesource.com/38670 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-25Fix hint tables parsing.Artem Strygin
Sample PDF: https://yadi.sk/d/oWLtAEfy3YbEb3 For offsets, equal to the hint stream offset, added hint stream length to determine the actual offset, because linearization inserted the hint stream at the original location of the object. Also the number of bits needed to represent the numerator of the fractional position for each shared object reference may be zero, if each shared group contains only one object with obj num, incremented on 1. Change-Id: I4754d603f388354821e8d0cac97ad99a7578fe4b Reviewed-on: https://pdfium-review.googlesource.com/36610 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-25Use document size instead of file size while parsing.Artem Strygin
We should use document size instead of File size, because all offsets and sizes was read from document should take into account of header offset. Added some tests of parsing of documents with header offset. Also drop friendship of CPDF_SyntaxParser with CPDF_Parser. Change-Id: Iebec75ab2ee07fb644a6c653b4ef5c2e09af09fe Reviewed-on: https://pdfium-review.googlesource.com/35830 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-24Fix UAF in CPDFSDK_Widget::GetMixXFAWidget().chromium/3502Henrique Nakashima
Do not allow instanceManager methods to run in Foreground XFA forms. They are static, and their widgets should not be inserted or removed. See "XML Forms Architecture (XFA) Specification Version 3.3", page 272. Bug: chromium:860697 Change-Id: Ia96834e085ee508618ca4dcb2bd5271466369ede Reviewed-on: https://pdfium-review.googlesource.com/38751 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-24Rename JS_{METHOD,PROP} to JSE_{METHOD,PROP}Tom Sepez
Because they are too easily confused with non-XFA JS_STATIC_PROP despite being on the XFA side. The JSE_ prefix mirrors the fxjs/fxjse split ("e" presumably standing for "extension" or some such) between the non-xfa/xfa V8 adapter layer. Rename fxjs/{cjx_define.h => jse_define.h}, since there aren't any symbols starting with |CJX| in it. Fix some IWYU for jse_define.h No functional changes. Change-Id: I6a0b2b6fe6ef1b564b0bfa2fa7ba317a0cea0953 Reviewed-on: https://pdfium-review.googlesource.com/38730 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-24Remove lpClass argument from FXJSE_RetrieveObjectBinding()Tom Sepez
In turn, it too is always nullptr. This shows that the V8 side check for hasInstance() was never being applied. We will augment this with C++ side checks down the road, since we don't want to trust V8 anyways. Change-Id: Iee38f32af9561783dbf253d798bd975029f3a4a2 Reviewed-on: https://pdfium-review.googlesource.com/38594 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-24Fix encryption dictionary owning.Artem Strygin
Return encryption dictionary as const reference from CPDF_Parser. Create a copy in CPDF_Creator if needed. Change-Id: I270f71d307d818fba7f65ebe379f5942ae816934 Reviewed-on: https://pdfium-review.googlesource.com/38390 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-23Tighten up ThisProxy casts.Tom Sepez
Previous CLs have shown that the "lpClass" checks aren't sufficient here, so ensure we are always checking C++ enum value before downcasting this type. Change-Id: I418127c5e7131e0a3363363a60d1976719d6837c Reviewed-on: https://pdfium-review.googlesource.com/38550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-23Remove unused CFXJSE_Arguments::GetObject()chromium/3501Tom Sepez
Insert another unowned ptr along the way. Change-Id: I953baa3448282fd4f655bb99524f131f66b7ed86 Reviewed-on: https://pdfium-review.googlesource.com/38593 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-23Remove argument from CFXJSE_Value::ToHostObject()Tom Sepez
Like the other cases, it is always nullptr. Change-Id: I280f25899ffbe5e35f4ef3342aec7896edf3e1f2 Reviewed-on: https://pdfium-review.googlesource.com/38592 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-23Rework of CPDF_Object writing.Artem Strygin
Move writing logic into implementation of related clases. Change-Id: If70dc418b352b562ee681ea34fa6595d6f52eee3 Reviewed-on: https://pdfium-review.googlesource.com/36350 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-23Remove second argument to CFXJSE_Engine::ToObject()Tom Sepez
It, too, is always passed as nullptr. Change-Id: I2573bea4cc33f48c13979026ea8ae42b368ce8a5 Reviewed-on: https://pdfium-review.googlesource.com/38590 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-23Add support of rebuilding crossrefs with compressed objects.Artem Strygin
Change-Id: I0743c34f0206f85828570430edb9f62b6b0cdbb5 Reviewed-on: https://pdfium-review.googlesource.com/37315 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-23Remove unused CScript_DataWindow::JSDataWindow().Tom Sepez
Do the same thing for N other similar files. Change-Id: If9bb7f6335287441206083c3512fc8a788e9d39b Reviewed-on: https://pdfium-review.googlesource.com/38532 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-23Replace CFXJSE_HostObject::type_ with polymorphic conversion methodsTom Sepez
More foolproof technique, and saves one word in every instance at a cost of two pointers in every subclass vtable. Change-Id: Ied4f91d4d203b5e6d83abe751159eb7e55489bb5 Reviewed-on: https://pdfium-review.googlesource.com/38530 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-07-23Remove second argument to ToJSContext().Tom Sepez
It's always passsed as nullptr. Rename function to ToFormCalcContext() for clarity while we're at it. Change-Id: I96581c6b86b7ac7b48b60429e2144f16af7e46ca Reviewed-on: https://pdfium-review.googlesource.com/38570 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-20Roll buildtools/ 893eb86b0..4ae75c1f8 (10 commits)chromium/3500chromium/3499Lei Zhang
https://chromium.googlesource.com/chromium/buildtools.git/+log/893eb86b02b2..4ae75c1f8188 Created with: roll-dep buildtools TBR=rharrison@chromium.org Change-Id: If395903298495f5131cb9a22b16db4c1c81fbd51 Reviewed-on: https://pdfium-review.googlesource.com/38490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>