summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-02-27Fix uninitialized memory read in CJS_Object::GetEmbedObject()Tom Sepez
The expected way to create native PDFium objects for JS is via the NewFxDynamicObject() call in C++, but that doesn't mean that the corresponding constructors won't be called from JS. In that case, the internal fields will be uninitialized, and subsequent method calls may try to use them. Add a constructor callback for all PDFium objects that nulls out these fields (shame that v8 doesn't do this by default, but probably saves some cycles). Then ensure that we check for this possibility in all the places it might turn up. Conversely, if we've just gotten a successful return from NewFxDynamicObject(), we know the CJS_Object/EmbedObj are good, so avoid checking there. BUG=695826 Change-Id: Iadad644c4af937def967ddc83daac1dad7544d69 Reviewed-on: https://pdfium-review.googlesource.com/2839 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-02-27Allow building XFA without additional codecs.Tom Sepez
This is something we'd like to try for initial XFA launches adding in codecs as justified by results in the wild. Adding statistics for the unsupported cases is a follow-up exercise once this builds correctly. We always build all the additional libraries, to allow fuzzers to link against them even if we are not shipping them. The linker will sort it out for the actual code. Rename some files to match the classes contained within. That the existing tests seem to pass with the codecs disabled warrants further investigation. Change-Id: Iad269db91289f12dc9f5dda8f48121d27a0c4367 Reviewed-on: https://pdfium-review.googlesource.com/2836 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-02-27Remove some pointless checks and assignments.Lei Zhang
Change-Id: I6f9fd67cdac581e8f91f829a5934b763bb229d21 Reviewed-on: https://pdfium-review.googlesource.com/2838 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-27Whitespace changeDan Sinclair
TBR=tsepez@chromium.org NOTRY=true Change-Id: I60e0f4d40a471c3b84232d9790b14dbe37aa89df Reviewed-on: https://pdfium-review.googlesource.com/2846 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-27Whitespace changeDan Sinclair
TBR=tsepez@chromium.org NOTRY=true Cr-Commit-Position: refs/heads/master@{#1} Change-Id: I11a43e7e9761788626fbbbab2a0902e492076ef1 Reviewed-on: https://pdfium-review.googlesource.com/2845 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-26core: fix two more uninitialized memberschromium/3025chromium/3024Miklos Vajna
Found by Coverity when scanning the bundled pdfium-3004 in LibreOffice. This fixes: - CID 1400335: Uninitialized members (UNINIT_CTOR) CPDF_DataAvail::m_dwTrailerOffset - CID 1400334: Uninitialized members (UNINIT_CTOR) CXML_Element::m_pParent Change-Id: I42da9a704ad75adf39c510c6ef89eb7a97860ea1 Reviewed-on: https://pdfium-review.googlesource.com/2670 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-02-24Remove repeated flags from CPDF_Fontchromium/3023Nicolas Pena
Moved all the flags to CFX_Font. Explicitly stated which ones are valued according to the PDF spec to avoid their values being changed. Change-Id: Ib57593234a4b9b83ef1ad593d0396c64159f303f Reviewed-on: https://pdfium-review.googlesource.com/2837 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-24Libtiff: fix leaking tables in tif_ojpeg.cNicolas Pena
Tables should be freed before they are reassigned. This CL fixes the three places where this is not happening. BUG=694599 Change-Id: I4e7cf1a6354b1129ecaf7ddcc74d8a36ba289df7 Reviewed-on: https://pdfium-review.googlesource.com/2830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-02-24Fix a wrong variable usage in PDF_EncodeText().Lei Zhang
BUG=chromium:694147 Change-Id: I388cb1d117318edb0339f5c7ee1d2b072f0fb741 Reviewed-on: https://pdfium-review.googlesource.com/2832 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-02-23Remove unused Icon::m_pIconStreamchromium/3022Tom Sepez
It is set, and passed around, but never operated upon. This removes another unowned ptr from JS back to C++ objects. Change-Id: I2a7eede050c6d844924e3c74395e7672ebb0213e Reviewed-on: https://pdfium-review.googlesource.com/2829 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-23Cleanup PWL_WndDan Sinclair
De-virtualize methods that are never overridden; put all virtual methods together; Remove some methods that are never called. Change-Id: I6ac9d8d6ecf78c59c1229f3cff3b1f205399649f Reviewed-on: https://pdfium-review.googlesource.com/2824 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-23Observe all formfill environment pointer in JS objects.Tom Sepez
Preventitve measure to decouple JS object lifetimes from C++ objects. Change-Id: I964a52590fcd0bfc26ac6055a7daf8aa33d455f3 Reviewed-on: https://pdfium-review.googlesource.com/2828 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-02-23Cleanup CFX_Graphics.Dan Sinclair
This Cl removes unused methods, removes unused return values, removes unused hatch data. Change-Id: Id76240170a3bd1c3ef156fbda25a6ac96462cbda Reviewed-on: https://pdfium-review.googlesource.com/2827 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-23Merge CFX_PathGenerator into CFX_Path.Dan Sinclair
The CFX_Path was the only user of the CFX_PathGenerator which in turn just proxied to the CFX_PathData. This CL removes the CFX_PathGenerator and merges the code up into CFX_Path. Change-Id: I9e1a3921c987830f29b2ff5bd4aceacd2082e8f0 Reviewed-on: https://pdfium-review.googlesource.com/2825 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-23Store JS string constants as single-byte strings.Tom Sepez
Save some space since none contain non-ascii characters. Avoid allocating C++ WideStrings just to convert back to UTF8 when defining properties. Change-Id: Id94db21b32ee7a96856c35a09f7550b54599ae13 Reviewed-on: https://pdfium-review.googlesource.com/2826 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-23Cleanup PWL_Utils.Dan Sinclair
This CL removes unused methods, moves methods to correct files and removes unused defines. Change-Id: I5087869b451e57d5325831814f0fa1c7f222cf4d Reviewed-on: https://pdfium-review.googlesource.com/2823 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-23Convert TransformPoint calls to Transform callsDan Sinclair
This Cl converts remaining calls to TransformPoint to use Transform instead. Change-Id: I7a2c000492da5dda3975b4449812f281816fdab6 Reviewed-on: https://pdfium-review.googlesource.com/2822 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-23Convert point x,y into CFX_PointFdan sinclair
This Cl converts the PointX,PointY pairs into a CFX_PointF. Change-Id: I46897832077c317a5bffb4e568550705decbc40c Reviewed-on: https://pdfium-review.googlesource.com/2821 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-22lcms upstream patches to fix security bugchromium/3021Nicolas Pena
Patch that fixes LUT consistency: https://github.com/mm2/Little-CMS/commit/9936ecf0745002cea8e46dc575079b4872e9af8c Patch that sanitizes MPE profiles: https://github.com/mm2/Little-CMS/commit/06662a755525586223efe1790da1497d5b2d9e67 BUG=675617 Change-Id: I9ccc4158432387360dcb358e2a015a9434df46e4 Reviewed-on: https://pdfium-review.googlesource.com/2820 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-22Convert OutputSelectedRect to take a rectDan Sinclair
This updates the CPDFSDK_FormFillEnvironment::OutputSelectedRect to match to CFX_SystemHandler::OutputSelectedRect method. Change-Id: Ia07c408533a4423cf81095c5467c9ee82a25988c Reviewed-on: https://pdfium-review.googlesource.com/2815 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-22Update Invalidate to take a rectDan Sinclair
This Cl updates the various Invalidate methods to take a rect when possible. Change-Id: I5359f4d8118f822347414ccb8d261aeef2ac35e0 Reviewed-on: https://pdfium-review.googlesource.com/2814 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-22Move JS constant tables to single-byte namesTom Sepez
none are non-ascii characters, so save space. Change-Id: I5e81e8847a2ce4a5ffa3422d2103ffe453036e7c Reviewed-on: https://pdfium-review.googlesource.com/2819 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-22Convert JS property tables to single-byte.Tom Sepez
Change-Id: I4daec9e05a63c55caa01402a594c3553073c439e Reviewed-on: https://pdfium-review.googlesource.com/2818 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-22Convert native method names to single-byte.Tom Sepez
There are no non-ascii characters, so save space. Change-Id: Ib9efb9386b6fc83bf3bb1810c791aadeeeebc259 Reviewed-on: https://pdfium-review.googlesource.com/2817 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-21Convert text positions from x,y to CFX_PointFDan Sinclair
This Cl converts the AllStates to use CFX_PointF and changes the advance code to return a CFX_PointF instead of accepting two out floats. Change-Id: Idb5e295b92e8a16ead535773de066f4b7ea2bdd9 Reviewed-on: https://pdfium-review.googlesource.com/2813 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-21Avoid some widestring to bytestring conversions in fxjs.Tom Sepez
None of the names have non-ascii characters. Change-Id: I83a52d6276edf2f442fca33221f38f6a53c3ffe3 Reviewed-on: https://pdfium-review.googlesource.com/2816 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-21Remove non CFX_PointF GetIndexAtPosDan Sinclair
This Cl removes the overload that takes a x,y position and uses the CFX_PointF version in all cases. Change-Id: Iebd048d91a1e1ed1c90ec0019e19750afe06e745 Reviewed-on: https://pdfium-review.googlesource.com/2812 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-21Convert CFWL messages to use CFX_PointFDan Sinclair
This Cl updates the various CFWL_Message classes to take CFX_PointF instead of x,y values. Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1 Reviewed-on: https://pdfium-review.googlesource.com/2811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-02-21Replace JS_IMPLEMENT_COLORPROP with helper function.Tom Sepez
Change-Id: Ifd2aa2de9a7a57bc2aa4aa49e5400467621a7851 Reviewed-on: https://pdfium-review.googlesource.com/2794 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-21Cleanup StreamContentParser transform methodsDan Sinclair
The ConvertTextSpace method was called once, and it was the only caller of ConvertUserSpace. Fold both methods back into the callsite and convert the use of TransformPoint to Transform. Change-Id: Ia09ec8846c28603df0616135ba1519dbbba219c3 Reviewed-on: https://pdfium-review.googlesource.com/2810 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-21Convert more TransformPoint calls to TransformDan Sinclair
This Cl converts several uses of TransformPoint to use Transform(CFX_PointF). Change-Id: I9bc3c484e0a4304b904584218bd9e59dec7db727 Reviewed-on: https://pdfium-review.googlesource.com/2791 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-21Remove some JS_Define macroschromium/3020Tom Sepez
Attempt at clarity. Change-Id: Ie37890888e1ec6e07cd10c68066b90f854fe6038 Reviewed-on: https://pdfium-review.googlesource.com/2719 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-21Pass CJS_Runtime to JS callbacks.Tom Sepez
This is much more convenient, since only a fraction of them need an IJS_EventContext, which can be obtained from the CJS_Runtime. Make GetCurrentEventContext() specific to CJS_Runtime, and return the concrete type. This saves a lot of casting. Change-Id: If79a3bcbf44de513f3caace153099234cc313d47 Reviewed-on: https://pdfium-review.googlesource.com/2793 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-17Libopenjpeg upstream fix for undefined shiftchromium/3019chromium/3018chromium/3017chromium/3016Nicolas Pena
Patch: https://github.com/uclouvain/openjpeg/commit/20789fed4ec7746e938dd2934a1fb5aa352f4d12 BUG=657440 Change-Id: Ic2320cd4baabbd7bc09ec428c5f49b7ab3e7eb66 Reviewed-on: https://pdfium-review.googlesource.com/2795 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-02-16Avoid a potential leak in CPDF_IndirectObjectHolderTom Sepez
Keep a vector of object superseeded by another object. These will no longer be returned from the holder, but it will clean them Change-Id: If9754ff6614bd79e9de6ce8c3492230435813218 Reviewed-on: https://pdfium-review.googlesource.com/2790 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-02-16Rename IJS_Context to IJS_EventContext.Tom Sepez
Prevents confusion with v8::Context, which is wrapped by a different IJS_ class. Change-Id: Iff75809e65015c0f810294de1f0d8ecf963150a3 Reviewed-on: https://pdfium-review.googlesource.com/2751 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-16Convert fx_font points to CFX_Point{F}sDan Sinclair
This converts the two Origin{X,Y} points in fx_font to CFX_Point{F} points. Change-Id: Id7cbb34a6e76043f1b26e9d7091d89f300dfc563 Reviewed-on: https://pdfium-review.googlesource.com/2720 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-16Change FXTEXT_CHARPOS to use CFX_PointFDan Sinclair
This CL updates the Origin x,y coordinates in FXTEXT_CHARPOS to be an CFX_PointF. Change-Id: I67281db2cb82687e12490145f7c99aee908e5fa8 Reviewed-on: https://pdfium-review.googlesource.com/2718 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-16CQ config: add gerrit CQAbility verifier.Andrii Shyshkalov
Goal is to ensure that unreviewed and untrusted code isn't sent through CQ to try bots, by accident or through malicious intent. R=agable@chromium.org BUG=chromium:692613 NOTRY=True Change-Id: I4bd5122b8176b172bcd0fa7cbd269a78363e46a8 Reviewed-on: https://pdfium-review.googlesource.com/2770 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-16Convert CPDF_TextPage classes to CFX_PointFchromium/3015Dan Sinclair
This CL converts the FX_FLOAT Origin values to CFX_PointF. Change-Id: Ic47d2bae1dd185fbc4ae88ac15fdd0fdf293c7f9 Reviewed-on: https://pdfium-review.googlesource.com/2716 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-16Convert CPDF_TextObject to CFX_PointFDan Sinclair
This CL converts the OriginX and OriginY from CPDF_TextObjectItem to use a CFX_PointF instead of two floats. Change-Id: Id39de18d3d908a86f925bec68d0680392f70906e Reviewed-on: https://pdfium-review.googlesource.com/2715 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-15Move generated graphics and font maps to CPDF_PageNicolas Pena
A new CPDF_PageContentGenerator is created for every call of FPDFPage_GenerateContent, so having the maps there will cause duplicated resources to be created every time this method is called. Thus it is better to move these to the page. Change-Id: I47804f79790fc5354f8a94b6387d66b65eda5a20 Reviewed-on: https://pdfium-review.googlesource.com/2717 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-02-15Make skia bots blockingDan Sinclair
The skia bots have been stable for a while, remove the experimental status so they don't get missed when refactoring. Change-Id: I008adc69b7a085f1f29a36016857a707eee7a44c Reviewed-on: https://pdfium-review.googlesource.com/2713 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com>
2017-02-15Cleanup GetZeroAreaPath methodchromium/3014Dan Sinclair
This CL simplifies some of the logic in GetZeroAreaPath. It also removes the side effect of resetting the object device matrix. Change-Id: Id1e355bde811341c5ceab0331fbe64b1aed895d5 Reviewed-on: https://pdfium-review.googlesource.com/2712 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-15Cleanup CFX_PathData.Dan Sinclair
This CL replaces the array of path points with a vector. Cleaning up the usage as required. Change-Id: Ifa386a2c847005fef68af748ebe99c4e08961238 Reviewed-on: https://pdfium-review.googlesource.com/2710 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-15Remove unused FX_RECT methodsDan Sinclair
These methods aren't used, removed. Change-Id: Iac298cbfe2cc46dd0358f591f1d7f44494a779c0 Reviewed-on: https://pdfium-review.googlesource.com/2714 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-15Add public API for adding text with standard fontsNicolas Pena
BUG=pdfium:667 Change-Id: I05e301385a7af4b6ce27dc0b885e23646abf3dd9 Reviewed-on: https://pdfium-review.googlesource.com/2711 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-15remove skia clipstack debuggingCary Clark
SkClipStack is going away. It was only used for debugging in PDFium. R=dsinclair@chromium.org Change-Id: I476bfe84874916fc7c72ae8942afb021662935d1 Reviewed-on: https://pdfium-review.googlesource.com/2730 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-14Replace CPWL_Point with CFX_PointFchromium/3013Dan Sinclair
The CPWL_Point is a subclass of CFX_PointF but adds no behaviour. Replacing with parent class. Change-Id: I5b971eb455a19c1e2bfebde86e4c8e2132bc62ad Reviewed-on: https://pdfium-review.googlesource.com/2654 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-14Prevent heap-buffer-overflow in CCodec_ProgressiveDecoderNicolas Pena
In CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback, m_pSrcPalette can be allocated size pal_num. So if pal_index >= pal_num, then bail out. BUG=691278 Change-Id: Ib0157cf51cbf52ecd5d60b027e5fc32898a906ed Reviewed-on: https://pdfium-review.googlesource.com/2699 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>