summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-03-14Replace FX_DOUBLE with underlying double type.Dan Sinclair
Change-Id: Ife4a46157ec1044b24965f7d282858f8261031b1 Reviewed-on: https://pdfium-review.googlesource.com/3030 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_CHAR and FX_WCHAR with underlying types.Dan Sinclair
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-14Merge text breaking helper classes.Dan Sinclair
This Cl merges the CFX_TxtPiece and CFX_RTFPiece classes into CFX_BreakPiece. CFX_TxtLine and CFX_RTFLine into CFX_BreakLine and CFX_TxtChar and CFX_RTFChar into CFX_Char. Change-Id: I95421bdf4cafd5e394db9238dea3603ccb8349c3 Reviewed-on: https://pdfium-review.googlesource.com/2966 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-13Remove openjpeg write support.thestig
Review-Url: https://codereview.chromium.org/2071693002
2017-03-13Fix boundary value negation in bmp_read_headerchromium/3041Nicolas Pena
When the value read is equal to -INT_MIN, we cannot negate it since it will be out of bounds, so return error in this case. BUG=chromium:628559 Change-Id: I7e47a71ef0d35cfb2d1fddc0ba644f9aac79ec3f Reviewed-on: https://pdfium-review.googlesource.com/2965 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Make most PDFium code pass Clang plugin's auto raw check.Lei Zhang
Change-Id: I9dc32342e24361389841ecba83081a97fc043377 Reviewed-on: https://pdfium-review.googlesource.com/2959 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-13Fix some nits in fx_codec_faxNicolas Pena
Change-Id: I16acba7b3eda26b4edfbfe0cb356267bd536fee8 Reviewed-on: https://pdfium-review.googlesource.com/2964 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Check run lengths in FaxG4GetRowNicolas Pena
The spec says a1 is to the right of a0, a2 to the right of a1. I think that means that the run lengths have to be positive, but that certainly means that they cannot be negative. BUG=chromium:699340 Change-Id: Ic07a272e63610f7a66c5073179cdb2768f80e2b8 Reviewed-on: https://pdfium-review.googlesource.com/2963 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-13Remove TextBreak rotation codeDan Sinclair
The rotation value is always 0 so we end up doing nothing for the rotation. Change-Id: Ib12a269d4f3c16961b1b934bf9dfc04d1c368e51 Reviewed-on: https://pdfium-review.googlesource.com/2943 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-13Remove unused TextBreak methodsDan Sinclair
This Cl removes some CFX_TxtBreak methods which aren't called. Change-Id: Ic66a89fa9c99aefb78d8314e1a3ebee089ef83cf Reviewed-on: https://pdfium-review.googlesource.com/2940 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-13Cleanup FX_TXTBREAKDan Sinclair
This Cl removes the FX_TXTBREAK defines and unifies the type with the CFX_RTFBreakType which is renamed to CFX_BreakType. Change-Id: I890ae5e08a65f922d714aaaa9ab0f9f8a882cb3c Reviewed-on: https://pdfium-review.googlesource.com/2939 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-10Bound cbox from tricky faceschromium/3040chromium/3039chromium/3038Nicolas Pena
The cbox values are long. We should make sure they are not too big before putting them into FX_RECT, which holds integers. The bound is chosen to also avoid overflow when multiplying by 1000. BUG=chromium:699961 Change-Id: Ie4443848e0319348110f7215bd1c909ef19dad9f Reviewed-on: https://pdfium-review.googlesource.com/2956 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-10Normalize channels when transforming CMYK to RGBNicolas Pena
PDF spec, section 'DeviceCMYK Color Space' states that: 'Each component is specified by a number in the range 0.0 to 1.0' BUG=chromium:699459 Change-Id: Ie476bbe8740c7b1b33c80be3e3dc4207df5e6e28 Reviewed-on: https://pdfium-review.googlesource.com/2954 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-07fx_codec_flate code cleanup.chromium/3035Dan Sinclair
This CL cleans up the namespacing along with some type confusion in the flate codec class. Change-Id: I4772ee571bcd78f1c839b5cefc370860aca06bb3 Reviewed-on: https://pdfium-review.googlesource.com/2917 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-07Limit BMP width to avoid overflowsNicolas Pena
BMP_WIDTHBYTES starts with: (width * bitCount) + 31. Since bitCount can be as large as 32, to avoid this overflowing we need width <= 67108863. BUG=chromium:628559 Change-Id: I4fd33b65da76225c8200a22380f2bfc4523c5c8d Reviewed-on: https://pdfium-review.googlesource.com/2934 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-07Cleanup text codeDan Sinclair
This Cl removes unused defines and methods. It also merges fx_arb into fx_arabic as the arb methods are only used in the arabic file and they are always included together. Change-Id: I1e6f75d5cb5f5bcc8db3b54cb2a14d284da5b7b1 Reviewed-on: https://pdfium-review.googlesource.com/2899 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-07Manual revert of: Avoid cloning in CPDF_ImageCacheEntry::ContinueGetCachedBitmapNicolas Pena
Not cloning is causing issues when printing to XPS printer. I have no idea why. CL being reverted: https://codereview.chromium.org/2518063005/ BUG=698350 Change-Id: I7c814c712f9959d10d0b6502a28e15ecd752f94a Reviewed-on: https://pdfium-review.googlesource.com/2930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-06Check size before writtingchromium/3033dan sinclair
Before writting to the stream buffer make sure that we won't walk off the end of the allocated size. In this specific case the dest_size of the buffer is 0, so we're basically just looping over to free the temp results. BUG=chromium:697847 Change-Id: I229eea96179692216cb2685facbb7d5379c501c7 Reviewed-on: https://pdfium-review.googlesource.com/2903 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-02Improve catching narrow fonts on LinuxNicolas Pena
Using the font name instead of the family name on Linux to increase the amount of fonts that get mapped to the default one. This is not done on the other OS because this is a hard-coding that should be avoided, and our bug PDF works fine on those OS. BUG=309664 Change-Id: I2d51f66d65dc042dd638c72c55a403ea78a90dfe Reviewed-on: https://pdfium-review.googlesource.com/2892 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-01Create virtual codec APIs so chrome/fuzzers can link separatelyTom Sepez
The one step to make an actual concrete class is conditionalized in fpdfview and is unconditional in the fuzzer. Also replace the clumsy C-style callbacks with a delegate interface as long as we are making new interfaces. Change-Id: I733a437483ce5e0c34211cfbbda05105336f55b5 Reviewed-on: https://pdfium-review.googlesource.com/2887 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-01Fix infinite loops in CPDF_MeshStream.Lei Zhang
BUG=chromium:690501 Change-Id: I74b09d90a8082554a67f737eb6adc3bff82ed93e Reviewed-on: https://pdfium-review.googlesource.com/2889 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-01Fixup RTFBreak and TextBreak nitsDan Sinclair
Change-Id: Ied5d23e18e9194e66d8be8d1057f55d83faada88 Reviewed-on: https://pdfium-review.googlesource.com/2880 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-28Remove unused methods from RTFBreak and TextBreakDan Sinclair
This Cl removes unused methods from the RTFBreak and TextBreak classes. Change-Id: If1e7e041cfd32b3be1240ae759f73c503b9c4cad Reviewed-on: https://pdfium-review.googlesource.com/2878 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-28Convert the FX_RTFBREAK defines to an enum classDan Sinclair
This Cl converts the type and updates the usage as required. Change-Id: I7c0f13aeabee1117086728333618504d3b65bb06 Reviewed-on: https://pdfium-review.googlesource.com/2876 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-28Remove unused layout stylesDan Sinclair
This Cl removes the unused layout styles from RTF Break and the supporting code. Change-Id: I5f4ef593250be1c9b3ae32f1ae3d9ce6913abdcc Reviewed-on: https://pdfium-review.googlesource.com/2874 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-28Avoid crash above CFWL_ListItem::GetText()Tom Sepez
The issue at hand is caused by a raw pointer rather than a retained pointer in InheritedData::m_pFontFamily. But the larger issue is that it's bad to Get() raw pointers from these, especially when its so cheap to pass them by const reference. One reason to Get() a raw pointer is to aid in down-casts, so add a helper to CFX_RetainPtr to give us downcasted retained pointers. BUG=pdfium:665 Change-Id: Ic8624af09664ff603de2e1fda8dbde0cf889f80d Reviewed-on: https://pdfium-review.googlesource.com/2871 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-28Clean up CXML_Element.chromium/3026Lei Zhang
- Set more members in the ctor - Remove dead code - Use more unique_ptrs Change-Id: Idfe85d07c784a57862f9314bc85f407f817b8f2f Reviewed-on: https://pdfium-review.googlesource.com/2844 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-27Fix nits from commit db764708.Lei Zhang
- Constify test data - ASSERT_EQ() buffer size - EXPECT_EQ() arguments are reversed - Fix typos in comments Change-Id: I846bfcc29bbf43d0a8b333250d1cce1aae5a8d59 Reviewed-on: https://pdfium-review.googlesource.com/2841 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@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-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-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-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-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-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-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-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-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-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-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-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>