summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-07-01M60: Fix a buffer overflow in FPDFPage_Flatten().chromium/3112Lei Zhang
BUG=chromium:732661 TBR=dsinclair@chromium.org Change-Id: Ie11a7d97db97ac969fb6230956efbf21c2ed3d87 Reviewed-on: https://pdfium-review.googlesource.com/6555 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> (cherry picked from commit f0f2a2a528e154b8ceeded297abc3a64007850f8) Reviewed-on: https://pdfium-review.googlesource.com/7231 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-14[Merge M60] Allow zero length streams when parsing.Dan Sinclair
It's possible to create a stream of length 0 in a PDF document. Currently the code will early exit and return a nullptr. This causes issues when you want to print the given PDF as the FPDF_ImportPages code ends up only generating up to the zero length object. This CL allows creating streams with length 0 and updates the PDF saving code to output a blank stream. TBR=thestig@chromium.org Bug: chromium:732380 Change-Id: I44182ba4aaac7c51284b002ba01bbc34b6bcf9e0 Reviewed-on: https://pdfium-review.googlesource.com/6490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> (cherry picked from commit 957480c17682008ae2a14723868fcdcab89b6577) Reviewed-on: https://pdfium-review.googlesource.com/6557 Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-25Mass conversion of all const-lifetime class membersTom Sepez
Sed + minimal conversions to compile, including moving some constructors into the .cpp file. Any that caused ASAN issues during the tests were omitted rather than trying to resolve the underlying issue. Change-Id: I00a421f33b253eb4071ffd9af3f2922c7443b335 Reviewed-on: https://pdfium-review.googlesource.com/5891 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-25Rename CPDF_LinkExtract test file to match classDan Sinclair
Change-Id: I6200968b0c72d2de32d51a741ac821084ad84f8a Reviewed-on: https://pdfium-review.googlesource.com/5952 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Break apart the pageint.h file.Dan Sinclair
This CL separates pageint.h and the supporting cpp files into indivudal class files. Change-Id: Idcadce41976a8cd5f0d916e6a5ebbc283fd36527 Reviewed-on: https://pdfium-review.googlesource.com/5930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-25Cleanup some nits in CFX_FontNicolas Pena
Change-Id: I30b59c794fc855fd36c33da3c60053ae08b3dac1 Reviewed-on: https://pdfium-review.googlesource.com/5910 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Fix FM2JSContext Round return typeDan Sinclair
This Cl fixes the return type of the Round method to return a double instead of a string. Change-Id: I740e375bdedfe22cb9f81d4beeaa079eac64b1bd Reviewed-on: https://pdfium-review.googlesource.com/5896 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-25Enable remaining boolean FM2JSContext testsdan sinclair
This CL updates the return type of the remaining boolean tests to be Integer and enables the tests. Change-Id: Ie2856ad31d17ffb496f33e6969912d0aae9678c5 Reviewed-on: https://pdfium-review.googlesource.com/5895 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Enable the FM2JSContext Exists testdan sinclair
This Cl fixes the Exists test of FM2JSContext to handle the return type of Integer instead of Boolean. Change-Id: I51c43e22eff5330de5ab5e63a925006af483f0ab Reviewed-on: https://pdfium-review.googlesource.com/5894 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Enable FM2JSContext Choose testsdan sinclair
This Cl enables the Choose tests for FM2JSContext. The Choose tests always return a String. Change-Id: I29b3ce4ed38f94886c6036f3766182fecb6e787b Reviewed-on: https://pdfium-review.googlesource.com/5893 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Enable most FM2JSContext boolean testsdan sinclair
This CL enables most of the FM2JSContext boolean tests. The return type is updated to Integer from Boolean. Change-Id: Ie3f665bd23a86e843cadb2ae8963767466bd1714 Reviewed-on: https://pdfium-review.googlesource.com/5892 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-24core: allow building against system lcms2chromium/3111Miklos Vajna
In a way similar to the existing USE_SYSTEM_ZLIB. The default is of course still the bundled lcms2. Change-Id: I219b50854b3c7870b0f4d94574ba39f6cb26f556 Reviewed-on: https://pdfium-review.googlesource.com/5870 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 10Tom Sepez
Change-Id: I4eab5e843580845753c5f80c05cf9490a85114b6 Reviewed-on: https://pdfium-review.googlesource.com/5890 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 9Tom Sepez
Change-Id: Ia1151e0855accda0873251938a521df1913c73fa Reviewed-on: https://pdfium-review.googlesource.com/5852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 8chromium/3110Tom Sepez
Change-Id: I99d6b4df72e369652301c36e4046f03ef95ed07d Reviewed-on: https://pdfium-review.googlesource.com/5837 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-24Use CheckedNumeric in BiInterpolImplNicolas Pena
This CL splits up BiInterpolImpl into the three interpolations its made of. In the interpolation, safe math is used, and a boolean keeps track of whether an overflow has occurred. If it does, we consider the patch to be invalid and immediately terminate the Draw method. Bug: chromium:724885 Change-Id: I4944ee1d821d8dd46c04e6b145eabe19d2ad8a5a Reviewed-on: https://pdfium-review.googlesource.com/5851 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-24Cleanup CBC_SymbolInfo::lookup().Lei Zhang
Remove unused variants and simplify the one remaining variant. Change-Id: I9b6e596b479f95319a3b69f5db2c4d1b2cff4ebf Reviewed-on: https://pdfium-review.googlesource.com/5834 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 4.Tom Sepez
Fix strange ownership issue in cpdf_type3char.cpp, and describe the absolutely insane stuff happening there. Change-Id: Iae70f9eca8f125ed3ef677729f1776ba9f10183c Reviewed-on: https://pdfium-review.googlesource.com/5830 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-24More FM2JSContext testsDan Sinclair
This CL adds tests for the FormCalc methods that don't require passing in a formcalc object reference. Change-Id: Ica6f15704cce525d38d25a27d1628089d2fc5a5a Reviewed-on: https://pdfium-review.googlesource.com/5691 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 5Tom Sepez
Change-Id: Ibdb20fca7e4daae9d61286df4801ac02faf3b281 Reviewed-on: https://pdfium-review.googlesource.com/5831 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 3.Tom Sepez
Remove an explicit clear to re-order the member destruction order. Change-Id: I33da3f3de4b8e8e0cfbdceaf5140e98f5d6f904a Reviewed-on: https://pdfium-review.googlesource.com/5791 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-23Remove longjmp from the Gif moduleNicolas Pena
The Gif module is only using the longjmp as a way to catch errors, so this CL makes it use GifDecodeStatus::Error instead. Change-Id: I9c97e63ed851d2a80e38f1d2cd9e8f297d608cb2 Reviewed-on: https://pdfium-review.googlesource.com/5850 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-23Remove useless CBC_SymbolShapeHint.Lei Zhang
Mark some methods as virtual/override in formerly CBC_SymbolShapeHint derived classes. Change-Id: Ia6d83e0b2c63c8fb440bc1d5beb258a796e1d42f Reviewed-on: https://pdfium-review.googlesource.com/5738 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-23Make CPDF_ImageCacheEntry retain CPDF_ImageTom Sepez
CPDF_PageRenderCache::m_ImageCache is a map from streams to an image cache entry containing a clump of data associated with the stream. Oddly, the clump includes the stream key (which we already have in order to get to the clump), but worse doesn't ensure the existence of the CPDF_Image object which (maybe) owns the stream key in question. So replace the stream with a retained ptr to the image. Also renamed an unrelated member to avoid confusion with the CPDF_Object in play. Bug: 724460 Change-Id: Id13d2c246918d4ff78c12b5bdb927f99c3f5e4e1 Reviewed-on: https://pdfium-review.googlesource.com/5771 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-23Clean up CBC_SymbolInfo.chromium/3109Lei Zhang
- Remove rectangular ctor param. It can be derived from dimensions. - Make members private and add accessors. - Remove exceptions that cannot occur. Change-Id: Iec113205241562a0559e594fe257f5b9064ed97e Reviewed-on: https://pdfium-review.googlesource.com/5737 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-23Minor updates to READMEJane
Bug: Change-Id: Ibfaa5f528834fb21c77684b9f4921f17ce4b5789 Reviewed-on: https://pdfium-review.googlesource.com/5811 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-23Do not include large unicode values in the ToUnicode mapNicolas Pena
Freetype can get to values larger than 0x10FFFF, but our current implementation of the ToUnicode mapping and the function FXSYS_ToUTF16BE does not support these values. Bug: chromium:724962 Change-Id: I7069f33429527dbf2d0bfd2033512fe909970c02 Reviewed-on: https://pdfium-review.googlesource.com/5810 Commit-Queue: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-23Cleanup default values and methods in CXFA_WidgetdataDan Sinclair
Change-Id: Ie591de17aba54d6d0f96b1133be7d899bab577cf Reviewed-on: https://pdfium-review.googlesource.com/5660 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-23Remove CBC_HighLevelEncoder::isSpecialB256().Lei Zhang
It just returns false. Also make more CBC_HighLevelEncoder members const. Change-Id: I0236e84db0d8b5e5fa1a99ebc4a809770a332471 Reviewed-on: https://pdfium-review.googlesource.com/5739 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-23Use NOTREACHED() in more places.Lei Zhang
Change-Id: I88466943171f19259f84add69679741d44c8e123 Reviewed-on: https://pdfium-review.googlesource.com/5551 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-22Convert more c-style pointers to CFX_UnownedPtrTom Sepez
Change-Id: I551b4210c95db0b916e9fe6cddf11e6c3d015c50 Reviewed-on: https://pdfium-review.googlesource.com/5790 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-22Fix crypto calculation regression due to typoWei Li
Use the correct values to calculate SHA512. BUG=pdfium:727,chromium:725267 Change-Id: I63d257c1df6304019a70f53df4653d358d3db525 Reviewed-on: https://pdfium-review.googlesource.com/5770 Commit-Queue: Wei Li <weili@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-22CFX_ByteStringC: avoid taking unreferenceable vector::data() ptr.chromium/3108Tom Sepez
Otherwise, the UnownedPtr destructor will try to probe it. ASAN knows about the structure of std::vector and will flag it as such. Bug: 724960 Change-Id: I2b24501704c3845a4b16edad191d7b8f41f77587 Reviewed-on: https://pdfium-review.googlesource.com/5750 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-22Use less opaque types in CPDFSDK_FormFillEnvironment.Lei Zhang
Fix type mismatches. Change-Id: Id475f927d0919f60a84f17bd9545ec67d569ff64 Reviewed-on: https://pdfium-review.googlesource.com/5740 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-20Better identify web links by trimming irrelevant charschromium/3107Wei Li
Sometimes, web links are written with other text such as punctuations which makes the extracted web links invalid. We improve this by trimming invalid chars at the end of host name only URLs. For example, host names never ends with ';' or ','. BUG=chromium:720578 Change-Id: Id619025b2153531376d268a69a3a89c3d49fce08 Reviewed-on: https://pdfium-review.googlesource.com/5692 Commit-Queue: Wei Li <weili@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-20Use observed ptrs from CFGAS_GEFont back to its font mgrs.chromium/3106Tom Sepez
CFGAS_GEFonts are ref counted, and its a good thing since they are managed by at least three different font managers: CFGAS_FontMgr, CXFA_PDFFontMgr, and CXFA_FontMgr. None of these have a clear claim to ownership of the CFGAS_GEFont. CFGAS_GEFont has back-pointers to two of these, CFGAS_FontMgr, and CXFA_PDFFontMgr, and they could each outlive the other. Thus the font needs to watch for destruction of either of its managers, so as to stop using it after its gone. Bug: 724640 Change-Id: I907ec35e300e11e532e13545d51fb200ac86b4f9 Reviewed-on: https://pdfium-review.googlesource.com/5735 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-20Use std::vector and std::sort() in CPDF_PageRenderCache.Lei Zhang
Instead of allocating a chunk of memory and using qsort(). Change-Id: I95041f79cfe609a9d99493d59eb074599ec49230 Reviewed-on: https://pdfium-review.googlesource.com/5690 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-20Use unowned ptr from CXFA_FFDocView to CXFA_FFDocTom Sepez
There's an unique_ptr going in the other direction, so it must outlive this. Change-Id: I28a77fbff67e6682360414e26c807d707602e140 Reviewed-on: https://pdfium-review.googlesource.com/5736 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-19Fix off-by-one introduced at ab20404Tom Sepez
Building a little-endian n-byte value via a single byte store and a memset(0) is dubious, but don't clobber the value we just stored. Bug: 723625 Change-Id: I015ea3e01c63a534f2ca0a1c085ed67777330d82 Reviewed-on: https://pdfium-review.googlesource.com/5732 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-19Update more references to sanitizers:depsTom Anderson
[1] updated sanitizers:deps references to exe_and_shlib_deps. However, this was only for *.gn files. I missed a *.gni file which is changed in this CL. [1] https://pdfium-review.googlesource.com/c/5670/ Bug=chromium:723069 R=thestig@chromium.org Change-Id: Ib5e0c0a31f4227b89d067f9645c2c78945c1ab4f Reviewed-on: https://pdfium-review.googlesource.com/5734 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-19Back-fill some functionality for CFX_UnownedPtrTom Sepez
Add Release() method, type-convertible compares and assigns, and right hand vs. left hand comparisons. Change-Id: I96b1112e328802143d314aa6c92948f26583fa90 Reviewed-on: https://pdfium-review.googlesource.com/5731 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-19ASAN flags zero-length StringC in GetMapModuleString()chromium/3105Tom Sepez
Corner case for StringCs: A non-referenceable ptr plus a zero length. The situation should be rare, so fix it at the spot of the foul rather than adding logic to the StringC constructors to zero the pointer when encountering zero length. Bug: 724500 Change-Id: I54b263f7db5ddef7bade6bfaa185a542ea20229c Reviewed-on: https://pdfium-review.googlesource.com/5730 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-19Add test duplicate check in presubmitNicolas Pena
This CL adds a presubmit check to avoid adding both .in and .pdf file to javascript and pixel tests. Change-Id: If2f252d20c3bfd3f9cd5963bb3428b57f6bee1b5 Reviewed-on: https://pdfium-review.googlesource.com/5710 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-19Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.Lei Zhang
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr holding a pointer to it. Remove assumptions that the codec modules may return nullptr, and do IWYU. Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5 Reviewed-on: https://pdfium-review.googlesource.com/5654 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-19Replace sanitizers:deps with exe_and_shlib_deps (pdfium)Tom Anderson
Roll build/ to f671d3b and replace "//build/config/sanitizers:deps" with "//build/config:exe_and_shlib_deps" Bug=chromium:723069 R=thestig@chromium.org Change-Id: Ib890f22a13769a594ce248637aeabc5ac3062ab2 Reviewed-on: https://pdfium-review.googlesource.com/5670 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-19Remove image dimension params that are never used.Lei Zhang
Change-Id: Ib219e23efdcb128772c4c3138531363af53780a1 Reviewed-on: https://pdfium-review.googlesource.com/5652 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-18Add pixel test for bug 113910Nicolas Pena
Bug: chromium:113910 Change-Id: I52d712828a0adde02b1e867421ee06f1ca8be1e2 Reviewed-on: https://pdfium-review.googlesource.com/5636 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-18Add more CFX_UnownedPtr usage.Tom Sepez
One lifetime issue was fixed by passing CPDF_RenderStatus into Continue() methods rather than holidng a pointer which was going stale. Bug: Change-Id: I63b9dce4c1a0d1377cc407b5460535f7c916a040 Reviewed-on: https://pdfium-review.googlesource.com/5659 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-18Use Unowned/Observed pointers between doc and FF onwership hierarchies.Tom Sepez
See the explanation in CPDFSDK_FormFillEnvironment.h Change-Id: I52feb25fb358831233a636e3ead5aa70e98c5baa Reviewed-on: https://pdfium-review.googlesource.com/5658 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-18Use UnownedPtr to check CFX_*StringC lifetimeschromium/3104Tom Sepez
Change interform to avoid temp StringC with dangling ptr. Change-Id: I8d8659973bcdf2cdbcaa6efa6012e4acce5f1604 Reviewed-on: https://pdfium-review.googlesource.com/5571 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>