summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-02-03Fix stack exhaustion in CPDF_DataAvail::HaveResourceAncestor()Tom Sepez
BUG=https://code.google.com/p/pdfium/issues/detail?id=113 R=thestig@chromium.org Review URL: https://codereview.chromium.org/880043004
2015-02-03Remove OpenJPEG header generator binary from PDFium build.chromium/2295John Abd-El-Malek
This is giving duplicate symbols for main when linking PDFium into Chromium. BUG=453844 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/897463003
2015-02-02Add embedder test for fix to bug_452455.Tom Sepez
BUG=452455 R=thestig@chromium.org Review URL: https://codereview.chromium.org/887063003
2015-02-01Fix GN PDFium build when building all.chromium/2294chromium/2293John Abd-El-Malek
The problem was FT_INTERNAL_DEBUG_H wasn't being defined because FT2_BUILD_LIBRARY wasn't set. So even if PDFium isn't using bundled FreeType, the FreeType target needs FT2_BUILD_LIBRARY defined. The GYP build was already correct. BUG=453844 TBR=brettw Review URL: https://codereview.chromium.org/891993003
2015-02-01Always use the FreeType headers included in PDFium.John Abd-El-Malek
The problem with trying to use the system headers sometimes is that we'll need to use pkg-config which is pretty slow. BUG=453844 TBR=brettw Review URL: https://codereview.chromium.org/865333003
2015-01-31Fix heap buffer overflow in CPDF_SampledFunc::v_CallJUN FANG
This issue was caused by integer overflow in CPDF_SampledFunc::v_Call. The root cause of this issue is that the content in the test pdf file was damaged. The solution is to check whether an integer is overflow before using it. BUG=452455 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/886953002
2015-01-30Don't export any OpenJPEG methods from PDFium.John Abd-El-Malek
It's only used internally. This also avoids errors from the verify_order script when linking PDFium into Chromium BUG=453844 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/887193002
2015-01-30Use system FreeType on Linux.John Abd-El-Malek
This saves 406KB in the binary size of the plugin. More importantly, it gets rid of the linker flag preventing bundling PDFium into the Chromium binary. BUG=453844 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/826613004
2015-01-30Track formhandles in EmbedderTest class itselfTom Sepez
This removes some duplicated code from each individual test. R=thestig@chromium.org Review URL: https://codereview.chromium.org/885403002
2015-01-29Fix infinite recursion in CPDF_RenderStatus::RenderSingleObject().Tom Sepez
Introduce a local static to track the recursion depth, thereby removing the burden for callers to track and pass a level parameter correctly through all call paths. Also increase the depth tolerated, since we know there were paths that were under-counting this value. BUG=451265 R=thestig@chromium.org Review URL: https://codereview.chromium.org/868253009
2015-01-29Add minimized test cases for stack exhaustion crash to repository.Tom Sepez
These reproduce under pdfium_test with a scale factor < 1.0. Add them to the repository now for the sake of posterity, even if we are not automatically testing them. BUG=451265 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/869923003
2015-01-29Merge to Master: Add output scale factor command line parameter to pdfium_test.Tom Sepez
Original Review URL: https://codereview.chromium.org/861203003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/889733002
2015-01-28Merge to Master: Cover fpdftext.h API with embeddertests.Tom Sepez
Original Review URL: https://codereview.chromium.org/878333003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/884873002
2015-01-27Add embedder test for stream length beyond end of file.Tom Sepez
This was fixed by https://codereview.chromium.org/743263002, but the bug remained open due to confusion. BUG=https://code.google.com/p/pdfium/issues/detail?id=57 R=thestig@chromium.org Review URL: https://codereview.chromium.org/878523003
2015-01-27Kill scattered extern _PDF_CharType declarations.chromium/2292chromium/2291chromium/2290Tom Sepez
While we're at it, avoid an indirection through a pointer, and use a name that isn't reserved for the compiler (leading _ CAP). This is a small portion of the associated bug: BUG=https://code.google.com/p/pdfium/issues/detail?id=112 R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/880663003
2015-01-26Fix infinite recursion in CPDF_Parser::ParseIndirectObjectAt().Tom Sepez
A suitably corrupted file can cause the parser(s) to repeatedly re-read sections of the file at increasing parser recursion depth until the stack is exhausted. There is supposed to be a check for this based upon the parser "level", but not all call paths pass or update the level as required. Much as I hate per-class statics, this introduces one to track the depth so that the check is enforced no matter how screwy the call path might be that leads the parser to re-enter itself. This is more palatable than trying to find all these paths and fix them. We know this is OK since there is only one thread in here modifying the static. BUG=451830 R=thestig@chromium.org Review URL: https://codereview.chromium.org/875263002
2015-01-23Fix test naming in previous commit.Tom Sepez
The embeddertests binary should have source files ending in _embeddertest, not _unittest. TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/871093004
2015-01-23Fix null crash in CheckTrailer.Tom Sepez
We are making checks in the incorrect order. Also adds two test cases, one for the this crash, and another for the original issue that motivated the patch. Original Patch by Bo at https://codereview.chromium.org/866003003/ BUG=450871 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/872563002
2015-01-22Add pdfium_embeddertests to BUILD.gnTom Sepez
This brings BUILD.gn into equivalence with pdfium.gyp. Blocked on https://codereview.chromium.org/851283006/ R=thestig@chromium.org Review URL: https://codereview.chromium.org/871453004
2015-01-22Fix build of pdfium_embeddertest under V8_USE_EXTERNAL_STARTUP_DATA.Tom Sepez
Currently, this is a difference between the standalone pdfium environment vs. pdfium as part of a chromium checkout. Locating the external data files is a nusiance when you don't have the binary's argv[0] line, so we create a new main that preserves this for us. R=thestig@chromium.org Review URL: https://codereview.chromium.org/851283006
2015-01-22Use IPDF_DataAvail interface to hide CPDF_DataAvail.Tom Sepez
Currently, no callers go through the Interface, which makes having a separate interface class kind of pointless. After converting callers away from using the CPDF_DataAvail concrete class, it can be moved from the header to the .cpp file. R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/873523002
2015-01-22Add API tests: NamedDestsByName, DestGetPageIndex.Tom Sepez
This also adds a fpdfdoc_embeddertest.cpp to keep the test file name matching with the API call under test. R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/812933004
2015-01-21Add tests for GetNamedDests() API.Tom Sepez
Follow-on work from patch at https://codereview.chromium.org/845643008. This incorporates that patch, plus adds tests for it and similar conditions. A few changes are introduced to correct expected behaviour. This also incoprorates Deepak's fix in https://codereview.chromium.org/845643008/ This incorporates a formerly unlanded tool to generate small valid PDF files from template input, which is needed to cover all the error cases here. See https://codereview.chromium.org/791993006/ BUG=450133 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/837723009
2015-01-21Use signed long for FPDF_GetNamedDest buffer length.Bo Xu
Need to have return value -1 indicating insufficient buffer. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/862163002
2015-01-21Simplify UTF16LE_Encode and add unittest.Bo Xu
Previously, UTF16LE_Encode take an optional flag to indicate if the returned byte string has trailing zeros. In fact, no where needs the flag to be false. So just get rid of it so callers won't misuse. The bug is found by https://codereview.chromium.org/837723009 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/860973002
2015-01-16Fix missing call to destroy library in embedder test.chromium/2289chromium/2288chromium/2287chromium/2286chromium/2285chromium/2284chromium/2283chromium/2282Tom Sepez
This was somehow lost along the way to creating embedder tests. Presumably this silently leaks in origin/master, but triggers an assert under XFA. Fixing this on master is a pre-requisite for merging all the embedder test code onto XFA. TBR=jam@chromium.org Review URL: https://codereview.chromium.org/856773003
2015-01-16Follow-on to pdfium_embeddertests.Tom Sepez
This includes: - Fix TestLoader lifetime. - Rename test file to match the equivalent .cpp under test - Re-organize a few tests to avoid duplicate loading - add tests for a few additional functions. R=jam@chromium.org Review URL: https://codereview.chromium.org/857483005
2015-01-15Allow FPDFBookmark_GetFirstChild to return the top level bookmarkTom Sepez
Previously when passing a NULL bookmark to FPDFBookmark_GetFirstChild it returned NULL instead of returning the top level bookmark. This change removes the early exit in this case allowing the top level bookmark to be retrieved. BUG=https://code.google.com/p/pdfium/issues/detail?id=110 R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/847243005
2015-01-15Create first pdfium embedder test.Tom Sepez
BUG=https://code.google.com/p/pdfium/issues/detail?id=62 R=jam@chromium.org Review URL: https://codereview.chromium.org/827733006
2015-01-15Land patch from issue 854603005 at patchset 1 (http://crrev.com/854603005#ps1)chromium/2281chromium/2280chromium/2279chromium/2278Tom Sepez
on behalf of qsr@ TBR=qsr@chromium.org Review URL: https://codereview.chromium.org/852983003
2015-01-14Ensure unittests are built when building all.John Abd-El-Malek
R=scottmg@chromium.org Review URL: https://codereview.chromium.org/849113002
2015-01-14Fix v8 external snapshot code for Windows.chromium/2277Ross McIlroy
Needed to land https://codereview.chromium.org/826083004/. BUG=421063, 439661 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/848443002 Patch from Ross McIlroy <rmcilroy@chromium.org>.
2015-01-12Merge to master: Fix include paths for pdfium_unittests under chromium checkoutTom Sepez
Orignal CL at https://codereview.chromium.org/852493002/ TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/849603003
2015-01-10Add APIs for getting bookmarks and named destinations.Bo Xu
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/834703002
2015-01-09Check for NULL pointers in CJBig2_SymbolDict::DeepCopy().chromium/2276chromium/2275chromium/2274chromium/2273Lei Zhang
BUG=445475 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/837093002
2015-01-09Add pdfium_unittests to BUILD.gnTom Sepez
Brings GN build up to sync with GYP build for this test binary. R=thestig@chromium.org Review URL: https://codereview.chromium.org/840343005
2015-01-09Only request C++11 when compiling C++ code.Bruce Dawson
Linux pdfium builds have 215 warnings of this form: command line option -std=gnu++11 is valid for C++/ObjC++ but not for C The obvious fix is to not request C++11 for C compilations. The only complication was the the switch we are using is actually gnu++0x, not gnu++11. BUG=https://code.google.com/p/pdfium/issues/detail?id=102 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/839163002
2015-01-09Fix -Wnon-virtual-dtor compiler warnings.Tom Sepez
This is done by explicitly adding a virtual dtor to interface classes, since the cost is small given that there are already virtual functions. The exceptions are for classes that have a Release() or Delete() method, in which case it is non-virtual and protected to indicate that the virtual class is never the deletion point. BUG= R=brucedawson@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/810883005
2015-01-08Land: Protect against a seg fault in CPDF_StructElementImpl constructor.Tom Sepez
patch from issue 680873002 at patchset 40001 (http://crrev.com/680873002#ps40001) TBR=jam@chromium.org Review URL: https://codereview.chromium.org/841943003
2015-01-07Finish unit test for CFX_ByteStringC class.Tom Sepez
This fixes a few cut-n-paste errors in the previous version, plus adds more corner cases. The implementation is fixed to handle a few of these that failed. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/808553013
2015-01-07Add ostream helpers for FX String classes.Tom Sepez
This allows integration with the gtest EXPECT_* macros. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/837843002
2015-01-06Resolve all but two VC++ build warnings in pdfium.Bruce Dawson
pdfium builds on Win32 have about 85 warnings (250 in the XFA branch, totaling over 480 lines!), mostly from four lines in a header file and a warning that should be disabled. This change resolves all but two of them and turns on warning-as-errors. Bugs have been filed for the two remaining warnings: https://code.google.com/p/pdfium/issues/detail?id=100 the 64-bit warnings: https://code.google.com/p/pdfium/issues/detail?id=101 and the Linux warnings: https://code.google.com/p/pdfium/issues/detail?id=102 The fix to the double->float truncation bugs will also improve code-generation. R=bo_xu@foxitsoftware.com, scottmg@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/792953005
2015-01-05Cleanup: Get rid of CRLF line endings.Lei Zhang
R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/837533003
2015-01-05Re-enable pdfium_unittests.chromium/2271chromium/2270chromium/2269Tom Sepez
In order for the standalone pdfium build to succeed, DEPS is updated to pull in gtest, and a stub gtest.gyp file is provided (which is unused under a chromium checkout). R=brucedawson@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/835233002
2015-01-05Update externs in unicodenormalization.cpp to not have array sizes.Lei Zhang
This is a follow-up to f9640495. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/825983004
2015-01-05Get rid of g_timeMap global object.Bruce Dawson
g_timeMap is a global variable with a constructor and destructor so it must be removed. BUG=441899 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/832703003
2015-01-05Fix an array size mismatch.Lei Zhang
The g_UnicodeData_Normalization_Map2 array is initialized with a size of 1724 in core\src\fpdftext\unicodenormalizationdata.cpp but its size is 1734 (+10) in core\src\fpdftext\unicodenormalization.cpp, 1724 seems to be the real size (i.e. there's 1724 values in the initialization list). BUG=446057 Original Author: sebmarchand@chromium.org Original CL: https://codereview.chromium.org/837523002/ Review URL: https://codereview.chromium.org/812843004
2015-01-05Remove run-time calculation of hash constants in pdfium.Bruce Dawson
PDFium static initializers must go. Static initializers are prohibited by the style guide. They have negative consequences including increased startup time (from pulling in additional code pages) and reduced sharing of data pages (since the variables can't go in the read-only data segment). This change uses a template struct and typed enums to reproduce JS_CalcHash at run-time. An unsigned long long constant and masking with 0xFFFFFFFF are used to avoid compile errors due to integer overflow of compile-time constants. The HashVerify class is used to check the results, necessary since none of the functions in global.cpp are called when pdfium_test.exe runs. const_expr would be a much cleaner way to implement this change but it is not yet widely supported. On the Windows release build this reduces the code size (.text virtual size) by 0x240 (576) bytes, the .data section by 0x20 bytes (for eight unsigned globals), and the .rdata section by 0x20 bytes (the unneeded string savings, minus the eight unsigned globals now being there). BUG=441899 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/792043005
2015-01-05Get rid of fifteen copies of m_sTimeMap and their initializers.Bruce Dawson
m_sTimeMap is a global variable with a constructor and destructor, which is not allowed. This change moves it to a function with a static pointer so that it is constructed on demand and then leaked, thus avoiding having startup and shutdown code. This also fixes a worrisome bug caused by having m_sTimeMap defined in a header file. Because m_sTimeMap was defined (and marked as static) in a header file there were fifteen separate copies of it, one for each source file which included the header file. This could easily lead to bugs because a timer that was added from one source file would be invisible to other source files. Each instance of m_sTimeMap added four entries to the dump-static-initializers.py report, for a total of sixty, so this fix significantly cleans up that report. BUG=441899 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/831903002
2015-01-05Clean up bookmark related codes.Bo Xu
Remove CPDF_Dictionary*() operator in CPDF_Bookmark class. Unify naming conventions and coding styles. Change some functions to const. Change the name of function argument to |pDict| for FPDF_xxx type variable. This makes the code more clear and gives better variable naming R=tsepez@chromium.org Review URL: https://codereview.chromium.org/828203002