summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-02-13Test top-level Document JS properties.chromium/2313chromium/2312chromium/2310chromium/2309chromium/2308chromium/2307chromium/2306chromium/2305Tom Sepez
Along the way, I rename some functions in pdfium_test.cc to match the style guide's FunctionName() syntax, adding "Example" to make them obviously different from the PDF internal code with similar name fragments. The purpose is to at least have some coverage for the setter/getter macros from JS_Define.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/928573002
2015-02-13Fix JPX image rendering that regressed due to several security fixes.Lei Zhang
BUG=453723 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/892553002
2015-02-12Fix an error 'Use-of-uninitialized-value in CPDF_Function::Call'JUN FANG
This issue was introduced in https://codereview.chromium.org/886953002/. BUG=454280 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/869343008
2015-02-12Create run_javascript_tests.pyTom Sepez
Top level script driver for testing/resources/javascript. Converts each input template file in that directory to a .pdf file in the working directory (typically out/Debug/gen/pdfium/testing/resources/javascript), invokes pdfium_test on it to generate , and crudely diffs the expected output. We can now remove generated .pdfs from source control, keeping only the hand-editable .in templates. R=thestig@chromium.org Review URL: https://codereview.chromium.org/912803004
2015-02-11CPDF_Object() constructor should set its internal m_Type variable.Tom Sepez
Follow-on from https://codereview.chromium.org/911293002/ Currently, all the subclass constructors are reaching up into the parent class to do this. Fix this, just because. R=thestig@chromium.org Review URL: https://codereview.chromium.org/880233005
2015-02-10Fix uninitialized value in CFX_ByteString::FormatIntegerchromium/2304chromium/2303chromium/2302JUN FANG
BUG=449845 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/911293002
2015-02-10Add JavaScript test for constants in Consts.cpp.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/908023003
2015-02-09Fix some typos in fpdf_render_loadimage.cpp.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/885223004
2015-02-06Cleanup: Fix some unused-function warnings.Lei Zhang
BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/891113002
2015-02-06Cleanup parts of fpdf_render_loadimage.cpp.Lei Zhang
- Add functions to do pitch calculation. - Delete dead code. - Don't bother checking pointers before deleting them. - Don't bother setting pointers to NULL in dtors. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/890883006
2015-02-06First JavaScript testing implementation.Tom Sepez
This is a plan for testing JS inside of pdf files under pdfium: Communication of results will be done via app.alert(), rather than console.println(), since the latter is not hooked up to any API callbacks. pdfium_test.cc is modified to be more careful about use of stdout/stderr, so that only the app.alert() and the unsupported feature callback use stdout. Diffing stdout against ..._expected.txt files gives the result. I added a /javascript directory to separate these from the embeddertest resources. The alert callback is backported from XFA. This was an omission. BUG=https://code.google.com/p/pdfium/issues/detail?id=62 R=jam@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/872103003
2015-02-05Fix GN build, fpdf_font_utility.cpp no longer present.Tom Sepez
Clean in standalone pdfium, but this would block a pdfium roll into chromium. TBR=jam@chromium.org Review URL: https://codereview.chromium.org/903903003
2015-02-05Kill off some more unreachable fopen's.Tom Sepez
The bstring's read from file is unused. The load from file paths aren't taken. R=jam@chromium.org Review URL: https://codereview.chromium.org/902943003
2015-02-05Merge to master: Kill off some dodgy JS callbacksTom Sepez
Note that this work was done opposite the usual branch order, because I didn't want to kill things in master that turned out to be in use in XFA. Original Review URL: https://codereview.chromium.org/883393007 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/903893002
2015-02-05Fix segv in CPDF_DataAvail::CheckRoot() when /Root object is a string.Tom Sepez
Handles the case of this malformed PDF without crashing. Note that to get a reproducible test case, a small fix is applied to our .py script which results in some whitespace/numbering difs across the resources (down the road, we ought to generate them on the fly in an intermediate directory). BUG=454695 R=jun_fang@foxitsoftware.com, thestig@chromium.org Review URL: https://codereview.chromium.org/895933003
2015-02-05Add namespace and-re-arrange PDFium's local copy of chromium /base.Tom Sepez
Any projects DEPS'd into chromium and requiring a /base subset should have a local copy of that subset in a separate namespace. This will avoid future naming conflicts. Re-arrange the directory structure to better identify what came from chromium's base, and to make drop-in replacement easier for files that contain hard-coded "base/" in their #include directives. R=jam@chromium.org Review URL: https://codereview.chromium.org/900753002
2015-02-04Update GN files from previous commit as well.chromium/2301chromium/2300chromium/2299chromium/2298chromium/2297chromium/2296John Abd-El-Malek
TBR=tsepez@chromium.org BUG=455399 Review URL: https://codereview.chromium.org/902753002
2015-02-04Initialize V8 outside of PDFium.John Abd-El-Malek
This is similar to how we initialize ICU for V8 inside PDFium. BUG=455399 R=wfh@chromium.org Review URL: https://codereview.chromium.org/897973002
2015-02-04Prevent base::CheckedNumeric from leaking outside of pdfium.Tom Sepez
Headers in /include directories should be free of implementation details from third_party. Put the types into a new header outside of /include. Requires https://codereview.chromium.org/902443003/ before a version containing this patch is rolled into chromium. R=jam@chromium.org Review URL: https://codereview.chromium.org/896023003
2015-02-03Replace CFX_SmartPointer cast operator with Get() method.Tom Sepez
This is part of the project to kill off C-style casts in the code base. Remove implict T* cast operator, and replace potentially unsafe C-style casts with Get() method. R=thestig@chromium.org Review URL: https://codereview.chromium.org/889673003
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