summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-08-30[Merge to M53] Fixup integer conversion logic.chromium/2785Dan Sinclair
In bc8a64029f898286c3dcad3a6cecdc98ef30b139 we updated the FX_atonum logic to correctly handle integer overflow. This causes issues when parsing the Permissions flag of encrypted documents as that flag isn't encoded like other numbers. The Permissions flag is a unsigned value, and has to be treated as such since the sign bit is always set. The current logic will detect an overflow of the int value and return 0. The old logic would have detected the overflow and returned the negative result regardless. This CL updates the logic to do the string to int conversion as a uint32_t and then verifies the uint32_t value, if a sign was provided, fits within the int range, otherwise it converts it to an int and lets it be positive or negative as needed. Merge clean TBRing. BUG=pdfium:539,chromium:642256 TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/2168173002 (cherry picked from commit 6f1025492801aaa93fca2c0ed7c40a3389ad8cd1) Review URL: https://codereview.chromium.org/2291183002 .
2016-08-16Merge 2 CLs to M53.Oliver Chang
TBR=tsepez@chromium.org Remove another potential stale CJS_Timer usage Fix memory ownership model for PDFium timers. The |app| class owns the CJS_Timer as part of its vector<unique_ptr> to them. The CJS_Timer "owns" its slot in the global ID to timer map, and removes itself when it is destroyed. Nothing else deletes from the global map. Deleting from the global map is accompanied by a callback to the embedder to clear its resources. Next, the proper way to remove a CJS_Timer is by going through the app, and having the app erase its unique ptr, which then deletes the CJS_Timer, which in turn cleans up the global map. Provide a CJS_Timer::Cancel static method to do this conveniently. There is a alternate path to the CJS_timer via JS and its CJS_TimerObj. CJS_TimerObj owns a TimerObj that currently points to the CJS_Timer. If the timer fires, and cleans itself up, this can go stale. Make the TimerObj maintain a weak reference via global timer ID rather than a direct pointer to the CJS_Timer, so that if the timer fires and is destroyed, future attempts to cancel find nothing. There is another path, where if the JS timer object is GC'd, then we just clean up its CJS_TimerObj without touching the actual CJS_Timers. We could make this match the spec by calling into the new cancel routine as described above, but it seems weird to have a timer depend on whether a gc happened or not. A subsequent CL will rename these objects to more closely match the conventions used by the other JS wrappers. BUG=634716 Review-Url: https://codereview.chromium.org/2221513002 (cherry picked from commit 8ca63de14d522d3d259d74fa43b28b05b02728e8) openjpeg: Prevent negative x, y values in opj_tcd_init_tile BUG=632622 Review-Url: https://codereview.chromium.org/2223303002 (cherry picked from commit b6befb2ed2485a3805cddea86dc7574510178ea9) Review URL: https://codereview.chromium.org/2251703003 .
2016-08-15Merge to M53: Fix issue when firing TimerProc() destroys timerOliver Chang
We must look the timer up a second time since the callback may have released it. BUG=634394 TBR=thestig@chromium.org Original Review-Url: https://codereview.chromium.org/2214003003 (cherry picked from commit 32e693fe13105fab5baf81b334e932fce62d89b5) Review URL: https://codereview.chromium.org/2247083002 .
2016-08-15[M53] Bound total pixels in JBig2 images to avoid overflows later.Tom Sepez
Also make these private to ensure they aren't modified so as to violate the bounds checks applied at creation time. BUG=633002 TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/2202013002 (cherry picked from commit e21501d9427539828b5d547b9d20a752d06914aa) Review URL: https://codereview.chromium.org/2242363002 .
2016-08-09Merge 3 CLs to M53.Oliver Chang
R=thestig@chromium.org Add bounds checks to CWeightTable::Calc() and friends. BUG=624514 Review-Url: https://codereview.chromium.org/2204773003 (cherry picked from commit 766901f5ec79b3c3ccd1e872f699642d771a89c5) openjpeg: Prevent overflows when using opj_aligned_malloc() BUG=628304 Review-Url: https://codereview.chromium.org/2218783002 (cherry picked from commit b20ab6c7acb3be1393461eb650ca8fa4660c937e) openjpeg: Prevent integer overflows during calculation of |l_nb_code_blocks_size| BUG=628890 Review-Url: https://codereview.chromium.org/2212973002 (cherry picked from commit ff74356915d4c7f7c6eb16de1e9f403da4ecb6d5) Review URL: https://codereview.chromium.org/2227743004 .
2016-08-02Merge to M53: Fix an integer overflow in opj_tcd_get_decoded_tile_size().Oliver Chang
Based on suggested patch by reporter. BUG=629919 TBR=thestig@chromium.org Original Review-Url: https://codereview.chromium.org/2182683002 (cherry picked from commit d8cc503575463ff3d81b22dad292665f2c88911e) Review URL: https://codereview.chromium.org/2204003002 .
2016-08-02Merge to M53: Reland of Remove pageview from map immediatelyDan Sinclair
This reverts commit f2cee9894b9f7cf2e50060965ad1eedd90ab55b6. This CL removes the default parameter from the CPDFSDK_Document::GetPageView |ReNew| flag and updates the code as needed. In CFFL_FormFillter::KillFocusForAnnot we flip the flag to |FALSE| as we don't want to re-create the page view if it is already removed. If we don't do this then the page view will be re-created in the map, the page associated to the page view, but then the page can be deleted out from under the pageview as it isn't owned by the page view. BUG=chromium:630654 Review-Url: https://codereview.chromium.org/2179163004 (cherry picked from commit 461eeafe191068ac8c32f2717907fc6a22a667d2) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/2200203002 .
2016-07-15Merge to M53: openjpeg: Prevent integer overflows during calculation of ↵Oliver Chang
|l_nb_precinct_size| TBR=thestig@chromium.org BUG=625541 Original Review-Url: https://codereview.chromium.org/2124073003 (cherry picked from commit 2f6d1480a1be2b1f82c94219c2d99e67d7e0660d) Review URL: https://codereview.chromium.org/2151113004 .
2016-07-15Remove constructor from functions that aren't constructorsJochen Eisinger
BUG=chromium:625823 TBR=haraken@chromium.org,thestig@chromium.org Review-Url: https://codereview.chromium.org/2128793002 (cherry picked from commit 3c27a84d15c06f85cc7f455f96dc124673f9f9d2) Review URL: https://codereview.chromium.org/2149763005 .
2016-07-15Remove prototypes from v8 functions that aren't constructorsJochen Eisinger
BUG=chromium:625823 TBR=haraken@chromium.org,thestig@chromium.org Review-Url: https://codereview.chromium.org/2123153002 (cherry picked from commit c4dedf32b1f5c71740df5be2a9b1446a01df304c) Review URL: https://codereview.chromium.org/2148793006 .
2016-06-28Change CXFA_Node::GetClassName to returnchromium/2786chromium/2784dsinclair
CXFA_Node::GetClassName currently takes an out parameter and returns void. This CL updates the signature to return the value and require no parameters. Review-Url: https://codereview.chromium.org/2104963002
2016-06-28Implement IJS_Runtime::Destroy().thestig
And call it from FPDF_DestroyLibrary(). Otherwise further attempts to FPDF_InitLibraryWithConfig() can hit fail an assertion in IJS_Runtime::Initialize(). BUG=604587 Review-Url: https://codereview.chromium.org/2103443004
2016-06-27Fix a regression from commit f3e6851.thestig
The index calculations are wrong for a reverse iterator. Review-Url: https://codereview.chromium.org/2101723002
2016-06-27Clean up some CPDF_Font subclasses.thestig
Review-Url: https://codereview.chromium.org/2093313002
2016-06-27Fix memory leaks with V8 startup data.thestig
Review-Url: https://codereview.chromium.org/2068563002
2016-06-27Clean up fxet_ap.cpp.thestig
Review-Url: https://codereview.chromium.org/2096143003
2016-06-27Simplify CPDF_TextRenderer::DrawTextString().thestig
Review-Url: https://codereview.chromium.org/2093033004
2016-06-27Double AdobeCMYK_to_sRGB speed with faster roundingbrucedawson
FXSYS_round is painfully slow on Windows. It does range checking and then calls an extremely expensive function. It ends up consuming half the CPU time when decoding the images in PDFs such as this one: https://www.ets.org/Media/Tests/GRE/pdf/gre_research_validity_data.pdf SSE can be used to optimize this: __m128 cmyk = {c * 255, m * 255, y * 255, k * 255}; uint32_t output[4]; _mm_storeu_si128((__m128i*)output, _mm_cvtps_epi32(cmyk)); but is cryptic, only works for x86/x64, and gives basically identical performance to this solution - int(c * 255 + 0.5f); The rounding behavior is not identical but in practice this rarely matters, and in this specific case it does not matter because the edge cases that vary are not hit. The three divisions at the end were changed to multiplies because profiling showed they were a significant cost. This change reduces the image-decode stalls in the PDF listed above by about 40%, making for a noticeably better experience. Further optimizations are possible but would require significantly more time and testing. BUG=617365 Review-Url: https://codereview.chromium.org/2096723003
2016-06-24pdfium clang/win: Stop passing /FIIntrin.hchromium/2783chromium/2782chromium/2781chromium/2780chromium/2779thakis
See https://codereview.chromium.org/2076483002 for a lengthy reasoning. The two mysterious files called out there were in boringssl and nacl, so for pdfium this should be a complete no-op. BUG=chromium:592745 Review-Url: https://codereview.chromium.org/2096143002
2016-06-24Revert "Turn on clang_use_chrome_plugins for GYP as well."thestig
This reverts commit f7f659c2c98a4d02e3695266d33f449b7be01af9. PDFium roll in Chromium fails on linux_chromium_chromeos_ozone_rel_ng. TBR=dsinclair@chromium.org BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2092273002
2016-06-24Remove IFWL_ToolTipTarget.thestig
It does not have an implementation. BUG=623135 Review-Url: https://codereview.chromium.org/2094013002
2016-06-23Improve hint table validation checks.thestig
Check required hint table dictionary entries and make sure they: - Exist. - Are of the right type. Along the way: - Fix FX_atonum() to not have a non-const pass-by-ref param. - Simplify code in CPDF_StreamContentParser. - Make CPDF_Number::IsInteger() a const method. BUG=610555 Review-Url: https://codereview.chromium.org/2095763003
2016-06-23Use some FXSYS methods instead of duplicatingdsinclair
This CL uses the FXSYS_isDecimalDigit in place of a few custom IsDigit methods. It also creates an iswspace and some fractional math helper methods to share some code. Review-Url: https://codereview.chromium.org/2094453004
2016-06-23Pass needed value to CXFA_Node constructordsinclair
Currently the CXFA_Node constructor will call out to lookup the object type for a given element type. There is only one called of this constructor and it already has the object type so just pass it through instead of getting the element data a second time. Review-Url: https://codereview.chromium.org/2092853002
2016-06-23Remove NULL in xfa/dsinclair
This CL converts all NULL's to nullptr. All instances of comparison to nullptr have been removed. Review-Url: https://codereview.chromium.org/2095653002
2016-06-23Change XFA_GetElementByName to XFA_GetElementTypeForNamedsinclair
This method was only ever used to get the XFA_Element type for the given element name. Changed to make the signature match the usage. Review-Url: https://codereview.chromium.org/2095733002
2016-06-23Turn on clang_use_chrome_plugins for GYP as well.thestig
BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2089823004
2016-06-23Cleanup some variable namings.chromium/2778dsinclair
This CL cleans up some variable namings from the XFA_Element enum change. Review-Url: https://codereview.chromium.org/2093663002
2016-06-23Load font maps in XFA.dsinclair
When XFA is enabled documents using some unicode fonts will render incorrectly as seen in the example attached to chromium:617490. This CL enables the loading of the font map files in XFA so we can correctly identify the character sets as unicode and map the glyphs correctly. BUG=chromium:617490 Review-Url: https://codereview.chromium.org/2097523002
2016-06-23Remove FPDFAPI_LoadCID2UnicodeMap.dsinclair
This Cl removes FPDFAPI_LoadCID2UnicodeMap() and inlines the code into the one caller. Review-Url: https://codereview.chromium.org/2097513002
2016-06-23Remove IsOrdinaryList; rename to OrdinaryList to Listdsinclair
IsOrdinaryList is no longer used, removed. Rename list item as Ordinary doesn't hold any meaning. Review-Url: https://codereview.chromium.org/2079393006
2016-06-23Remove CXFA_OrdinaryObject classdsinclair
The CXFA_OrdinaryObject class no longer has any functionality but is just wraps CXFA_Object and sets the object type for the sub classes. This Cl removes the class and has the subclass set the object type themselves. This CL also renames the OrdinaryObject type to just Object. Review-Url: https://codereview.chromium.org/2082343003
2016-06-22Update GetClassID to GetElementTypedsinclair
The GetClassID method actually returns the XFA_Element, change the name of the method to be more suggestive of the return value. The GetClassID was sort-of polymorphich and would call down to subclasses. This CL changes the data to be stored on the CXFA_Object class and just returns what is set. The values are set in the constructor as needed. Review-Url: https://codereview.chromium.org/2082573007
2016-06-22Remove unused GetScriptObjHash().dsinclair
Method is never called, remove it and the data variable it uses as it will no longer be used. Review-Url: https://codereview.chromium.org/2088173003
2016-06-22Remove some fx_dib functions with unused parameters.thestig
Review-Url: https://codereview.chromium.org/2075383002
2016-06-22Fix Skia GN build on Macweili
The build has been broken. This should make it compilable. Review-Url: https://codereview.chromium.org/2075343002
2016-06-22Fix memory leaks in EmbedderTest::OpenDocument().thestig
EmbedderTest::OpenDocument() does not gracefully handle the case of being called twice in a given test case. So avoid doing that. Review-Url: https://codereview.chromium.org/2088093002
2016-06-21Use FXFONT defines in place of integers.thestig
Fix nits along the way. Review-Url: https://codereview.chromium.org/2083943003
2016-06-21Convert XFA_ELEMENT to an enum classdsinclair
This CL changes XFA_ELEMENT From an enum to an enum class. The type name was updated to XFA_Element. Review-Url: https://codereview.chromium.org/2089443002
2016-06-21Update the documentation: no longer needs to set clang_use_chrome_pluginsweili
PDFium can be compiled with clang_use_chrome_plugins=true, which is the default setting. So we no longer need to set the variable. BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2085803003
2016-06-21Add win_xfa_clang trybotweili
Also clean up the file by ordering the trybots by names. BUG=chromium:619726 Review-Url: https://codereview.chromium.org/2088533004
2016-06-21Move ifx_renderdevicedriver to a separate file to shareweili
Move ifx_renderdevicedriver class to its own file to share with multiple devices to reduce code duplication. Review-Url: https://codereview.chromium.org/2078783002
2016-06-21Add android to the CQ as a 100% experiment.jbudorick
BUG=pdfium:416 Review-Url: https://codereview.chromium.org/2083993002
2016-06-20Add stackexploit@gmail.com to AUTHORS file.chromium/2777chromium/2776chromium/2774ochang
R=thestig@chromium.org Review-Url: https://codereview.chromium.org/2084663003
2016-06-20Fix clang_use_chrome_plugin for Mac and Skia buildsweili
These changes are specific to Mac and Skia builds. They are needed for these builds to compile with clang_use_chrome_plugin. BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2081523002
2016-06-20Change func(void) to func()weili
Since PDFium is compiled as C++ code, the void keyword is not needed. BUG=pdfium:519 Review-Url: https://codereview.chromium.org/2084603003
2016-06-20openjpeg: Prevent a buffer overflow in opj_j2k_read_SQcd_SQcc.stackexploit
BUG=chromium:619405 R=ochang@chromium.org Review-Url: https://codereview.chromium.org/2071773002
2016-06-20Split the XFA_OBJECTTYPE enum into two parts.dsinclair
Currently the object type and the node flags are both mixed into the single XFA_OBJECTTYPE_* enum. These two things are un-related and should not share a single type. This Cl creates an XFA_ObjectType enum class and a XFA_NodeFlag enum to hold the two types. Accessors are added to determine if the flags are set (or called where they already existed. Review-Url: https://codereview.chromium.org/2083453003
2016-06-20Remove unused CFX_Font members.thestig
Review-Url: https://codereview.chromium.org/2077243002
2016-06-20Another round of fx_ge cleanup.thestig
- Clean up CFX_GEModule. - Remove duplicate #defines in fx_ge.h - Remove IsFontStyleFromCharCode() that always returns true. - Mark a FXTEXT_CHARPOS field as Mac only. Review-Url: https://codereview.chromium.org/2075333002