pdfium.git
4 years agoFlip the shut down order in tests.
Lei Zhang [Thu, 16 Jul 2015 00:10:52 +0000]
Flip the shut down order in tests.

This matches the Chromium PDF plugin changes in
https://codereview.chromium.org/1230313006/

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1237233006 .

4 years agoMake ContentStreamParser members private, fix constructor
Tom Sepez [Wed, 15 Jul 2015 23:54:50 +0000]
Make ContentStreamParser members private, fix constructor

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1219683007 .

4 years agoAdd a null pointer check to CPDF_CalRGB::v_Load().
Lei Zhang [Wed, 15 Jul 2015 23:11:10 +0000]
Add a null pointer check to CPDF_CalRGB::v_Load().

BUG=492055
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1241923005 .

4 years agoKill Func_Renderpage global function pointer, it never changes.
Tom Sepez [Wed, 15 Jul 2015 22:30:18 +0000]
Kill Func_Renderpage global function pointer, it never changes.

Kill some unused macros along the way, and put prototypes
in header files.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1233203004 .

4 years agoRevert "Add test case for parsing endobj keywords."
Tom Sepez [Wed, 15 Jul 2015 17:10:53 +0000]
Revert "Add test case for parsing endobj keywords."

This reverts commit 5bd88ec07e79215400777f3095c6843e0627cade.

4 years agoAdd test case for parsing endobj keywords.
Tom Sepez [Wed, 15 Jul 2015 17:01:29 +0000]
Add test case for parsing endobj keywords.

There is no assurance that the expected result files are consistent
with other readers.  Jun will have to verify that after making his
parser changes for bug 493126.

BUG=493126
R=thestig@chromium.org, jun_fang@foxitsoftware.com

Review URL: https://codereview.chromium.org/1232803005 .

4 years agoAdd missing reinterpret_cast from void to v8::Isolate*
Jochen Eisinger [Wed, 15 Jul 2015 12:47:39 +0000]
Add missing reinterpret_cast from void to v8::Isolate*

BUG=none
TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1241863003 .

4 years agoRevert "Pump the v8 message loop in tests"
Jochen Eisinger [Wed, 15 Jul 2015 12:47:01 +0000]
Revert "Pump the v8 message loop in tests"

This reverts commit 304578020122cc4d2a4a8c1598694ef2b9be92b5.

Turns out that in both cases v8 is already destructed at those points,
and we can't pump the message loops.

TBR=tsepez@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1236603003 .

4 years agoPlumb in an externally created v8::Isolate
Jochen Eisinger [Wed, 15 Jul 2015 12:31:29 +0000]
Plumb in an externally created v8::Isolate

In Chrome, all Isolates must be created by gin

R=tsepez@chromium.org, ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1234053003 .

4 years agoPump the v8 message loop in tests
Jochen Eisinger [Wed, 15 Jul 2015 12:28:17 +0000]
Pump the v8 message loop in tests

R=tsepez@chromium.org, ulan@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/1230393006 .

4 years agoMove extern cmap declarations from .cpp files into new .h files.
Tom Sepez [Wed, 15 Jul 2015 00:06:23 +0000]
Move extern cmap declarations from .cpp files into new .h files.

That way, the compiler can check them against the definitions rather
than just relying on the linker to line things up.

Make the types of the declarations and definitions match exactly,
instead of being synonym typedefs of each other.

Fix some IWYU and use FX_ArraySize where possible.

BUG=https://code.google.com/p/pdfium/issues/detail?id=178
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1221503005 .

4 years agoMove FPDFAPI_FlateInit() prototype and friends to .h file
Tom Sepez [Tue, 14 Jul 2015 23:33:32 +0000]
Move FPDFAPI_FlateInit() prototype and friends to .h file

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1240713004 .

4 years agoTighten up DEPS include rules.
Tom Sepez [Tue, 14 Jul 2015 23:17:53 +0000]
Tighten up DEPS include rules.

Allows the following command to return only legitimate
warnings:
  buildtools/checkdeps/checkdeps.py --resolve-dotdot

The remaining warnings consist of:
  - fx_parser_filters.cpp, due to inclusion of
    third_party/zlib_v128/zlib.h, showing the lack
    of a header and some prototypes in that .cpp file.

  - third_party/*, due to inclusion of fx_system.h and
    the like, indicating adulterated libraries that should
    be restored to their pristine state.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1233583004 .

4 years agoFix an integer overflow issue in openJpeg
JUN FANG [Mon, 13 Jul 2015 13:34:20 +0000]
Fix an integer overflow issue in openJpeg

Fixing this issue for an urgent request. It should be fixed in OpenJPEG side.

BUG=506763
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1231933008 .

4 years agoFix a crashier due to incorrect type conversion
JUN FANG [Mon, 13 Jul 2015 11:20:10 +0000]
Fix a crashier due to incorrect type conversion

BUG=issue179
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1217093006 .

4 years agoMake CJBig2_Object::operator delete accept nullptr
Vitaly Buka [Fri, 10 Jul 2015 22:40:59 +0000]
Make CJBig2_Object::operator delete accept nullptr

Standard delete operator should do noting for nullptr.
Overloaded CJBig2_Object::operator delete de-referenced
provided pointer causing crashes after
https://codereview.chromium.org/1192743004/

TBR=thestig
BUG=508197

Review URL: https://codereview.chromium.org/1230763007 .

4 years agoRemove a superfluous qualifier. No behavior change.
Nico Weber [Sat, 4 Jul 2015 22:07:29 +0000]
Remove a superfluous qualifier. No behavior change.

BUG=505296
R=brucedawson@chromium.org

Review URL: https://codereview.chromium.org/1221673007.

4 years agoAdd parentheses around && within ||.
Nico Weber [Thu, 2 Jul 2015 21:40:08 +0000]
Add parentheses around && within ||.

BUG=504699
R=raymes@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/1213433005.

4 years agoRevert "Revert "Redo range check in CPDF_SampledFunc::v_Call().""
Tom Sepez [Wed, 1 Jul 2015 23:14:29 +0000]
Revert "Revert "Redo range check in CPDF_SampledFunc::v_Call().""

This reverts commit 327080bacabb3d90094144e66ae57037d4a8d8e6.
This re-lands the patch, but removes the tests which would require
512MB buffers to be reliably allocatable on small bots. It
also adds
small fixes accumulated while diagnosing it.

R=sanqingsong@gmail.com

Review URL: https://codereview.chromium.org/1214403002.

4 years agoFix some clang warnings with -Wmissing-braces in pdfium.
Nico Weber [Wed, 1 Jul 2015 21:08:08 +0000]
Fix some clang warnings with -Wmissing-braces in pdfium.

Clang warns if there are missing braces around a subobject
initializer. The most common idiom that triggers this is:
  STRUCT s = {0};
if the first field of STRUCT is itself a struct. This can
be more simply written as:
  STRUCT s = {};
which also prevents the warning from firing.

Other instances of the warning have been fixed by adding
braces where appropriate.

R=brucedawson@chromium.org

Review URL: https://codereview.chromium.org/1213523004.

4 years agoFix a clang warning about a dangling else.
Tom Sepez [Tue, 30 Jun 2015 21:48:48 +0000]
Fix a clang warning about a dangling else.

BUG=none
R=brucedawson@chromium.org

Review URL: https://codereview.chromium.org/1223433002.

4 years agoRevert "Redo range check in CPDF_SampledFunc::v_Call()."
Tom Sepez [Tue, 30 Jun 2015 19:28:46 +0000]
Revert "Redo range check in CPDF_SampledFunc::v_Call()."

This reverts commit 74742a75ac7a07c08cf36fe6f4eaa91bed8236a3.

4 years agoRedo range check in CPDF_SampledFunc::v_Call().
Tom Sepez [Tue, 30 Jun 2015 19:18:55 +0000]
Redo range check in CPDF_SampledFunc::v_Call().

The current |bitpos1| calculation protects the passed argument to
_GetBits32(): |bitpos.ValueOrDie() + j * m_nBitsPerSample|, but doesn't
account for adding in the sample length in that routine.

Also bound bits per sample to something reasonable to avoid undefined
behaviour on the shift to compute the max value.

BUG=471990
R=jun_fang@foxitsoftware.com

Review URL: https://codereview.chromium.org/1219663003.

4 years agoRemove references to three deleted files.
Bruce Dawson [Mon, 29 Jun 2015 20:13:28 +0000]
Remove references to three deleted files.

The gyp-to-ninja conversion process doesn't check for missing files, so
they creep in. This change deletes three files that were deleted or
never added but which are referenced from .gyp files.

To see warnings about deleted files (Windows only) set GYP_GENERATORS
to msvs-ninja,ninja before running build\gyp_pdfium. The msvs-ninja
generator warns on missing files.

R=tsepez@chromium.org
BUG=483424

Review URL: https://codereview.chromium.org/1201273006.

4 years agoFix Javascript tests after commit f55771af6429.
Lei Zhang [Mon, 22 Jun 2015 22:36:49 +0000]
Fix Javascript tests after commit f55771af6429.

- Return true instead of false. All the other unsupported JS
  functions return true.
- Adjust test expectations accordingly.

TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/1196163006.

4 years agoCleanup: Get rid of CPDF_Reference::Create().
Lei Zhang [Mon, 22 Jun 2015 22:16:15 +0000]
Cleanup: Get rid of CPDF_Reference::Create().

Just call new CPDF_Reference instead.

R=jam@chromium.org

Review URL: https://codereview.chromium.org/1194343002.

4 years agoCleanup: Remove more checks for new returning NULL.
Lei Zhang [Mon, 22 Jun 2015 22:13:36 +0000]
Cleanup: Remove more checks for new returning NULL.

R=jam@chromium.org

Review URL: https://codereview.chromium.org/1198903002.

4 years agoCleanup: Remove CFX_MapPtrToPtr from fpdfppo.cpp.
Lei Zhang [Mon, 22 Jun 2015 22:11:56 +0000]
Cleanup: Remove CFX_MapPtrToPtr from fpdfppo.cpp.

R=jam@chromium.org

Review URL: https://codereview.chromium.org/1194153002.

4 years agoDelete dead code for deleting pages and icons.
Lei Zhang [Mon, 22 Jun 2015 22:10:28 +0000]
Delete dead code for deleting pages and icons.

1) Document::deletePages()
2) CPDFSDK_Document::DeletePages()
3) Document::removeIcon()
4) IconTree::DeleteIconElement()

Originally (1) called (2), but only when FOXIT_CHROME_BUILD was not
defined. Since it was always defined for PDFium, this was effectively
dead code the whole time. Ditto for (3) and (4). The functions were
deemed unsafe in https://crbug.com/67100

R=jam@chromium.org

Review URL: https://codereview.chromium.org/1193323002.

4 years agoCleanup: Remove dead formfiller code.
Lei Zhang [Mon, 22 Jun 2015 22:09:03 +0000]
Cleanup: Remove dead formfiller code.

R=jam@chromium.org

Review URL: https://codereview.chromium.org/1196853002.

4 years agoCleanup: Remove dead CPDF_InlineImages code.
Lei Zhang [Fri, 19 Jun 2015 22:11:20 +0000]
Cleanup: Remove dead CPDF_InlineImages code.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1192413007.

4 years agoReplace CFX_MapPtrTemplate with std::map.
Lei Zhang [Fri, 19 Jun 2015 22:09:45 +0000]
Replace CFX_MapPtrTemplate with std::map.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1181593003.

4 years agoCleanup: Do not check pointers before deleting them.
Lei Zhang [Fri, 19 Jun 2015 21:51:10 +0000]
Cleanup: Do not check pointers before deleting them.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1192743004.

4 years agoSmall cleanup of CPDF_TextObject and other CPDF_PageObject subclasses.
Lei Zhang [Fri, 19 Jun 2015 21:43:51 +0000]
Small cleanup of CPDF_TextObject and other CPDF_PageObject subclasses.

- Add overrides
- Remove empty overrides
- Remove dead friends
- Cleanup bad formatting

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1199563002.

4 years agoDisintermediation.
Tom Sepez [Fri, 19 Jun 2015 20:38:19 +0000]
Disintermediation.

Removed several header files that simply proxy other headers.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1199553002.

4 years agoMove zlib to third_party/
Tom Sepez [Fri, 19 Jun 2015 19:39:19 +0000]
Move zlib to third_party/

Remove some fx_* files that simply included other files along the way.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1197693003.

4 years agoMove libopenjpeg to third_party/
Tom Sepez [Fri, 19 Jun 2015 00:05:27 +0000]
Move libopenjpeg to third_party/

We get to delete a whole bunch of fx_foo.c files that did nothing
but #include "foo.c" after defining _CRT_SECURE_NO_WARNINGS. Do this
from the .gyp/.gn files instead.

Also sort some "config"s in .gn file.

R=thestig@chromium.org

Committed: https://pdfium.googlesource.com/pdfium/+/c7a17bf9cdb0d646aa8b653e6ab2678a1837ed6a

Review URL: https://codereview.chromium.org/1185373010.

4 years agoFix CPDF_ICCBasedCS::GetDefaultValue heap-buffer-overflow.
Tom Sepez [Thu, 18 Jun 2015 22:58:26 +0000]
Fix CPDF_ICCBasedCS::GetDefaultValue heap-buffer-overflow.

Introduced in ea44bd0.  Re-animating the dead (code) usually turns
out badly, and this is no exception.  Make both of the uncallable
methods go away.

BUG=501889
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1179773007.

4 years agoRevert "Move libopenjpeg to third_party/"
Tom Sepez [Thu, 18 Jun 2015 00:30:47 +0000]
Revert "Move libopenjpeg to third_party/"

This reverts commit c7a17bf9cdb0d646aa8b653e6ab2678a1837ed6a.

4 years agoMove libopenjpeg to third_party/
Tom Sepez [Thu, 18 Jun 2015 00:17:14 +0000]
Move libopenjpeg to third_party/

We get to delete a whole bunch of fx_foo.c files that did nothing
but #include "foo.c" after defining _CRT_SECURE_NO_WARNINGS. Do this
from the .gyp/.gn files instead.

Also sort some "config"s in .gn file.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1185373010.

4 years agoReplace some Release() calls with virtual destructors.
Tom Sepez [Wed, 17 Jun 2015 23:38:51 +0000]
Replace some Release() calls with virtual destructors.

A virtual method that does |delete this| is an anti-pattern.
Some classes can be de-virtualized instead.
Throw in some unique_ptrs and delete dead code for good measure.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1192013002.

4 years agoRun GYP after gclient sync.
Tom Sepez [Wed, 17 Jun 2015 22:46:38 +0000]
Run GYP after gclient sync.

Makes the behaviour consistent with chromium.
Also fix some indentation.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1193563002.

4 years agoMove libjpeg to third_party/
Tom Sepez [Wed, 17 Jun 2015 22:24:01 +0000]
Move libjpeg to third_party/

Removal of fpdfapi_ suffix can be part of a future CL.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1186113005.

4 years agoMove lcms2 into third_party
Tom Sepez [Wed, 17 Jun 2015 17:48:05 +0000]
Move lcms2 into third_party

Second CL to apply less restrictive flags to third party.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1181943008.

4 years agoSeparate agg-authored code from fx-authored code.
Tom Sepez [Tue, 16 Jun 2015 23:29:44 +0000]
Separate agg-authored code from fx-authored code.

Creates a separate library so we can apply less-strict warnings to
the code we can't change from upstream vs. the code we can change,
reducing noise in the standalone build.

Remove needless foo.{cpp,h} files that merely perform indirection
via #include "some_other_path/foo.{cpp,h}".

BUG=pdfium:166
R=brucedawson@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1152743007.

4 years agoAdd constructor for CPDF_ColorSpace.
Tom Sepez [Tue, 16 Jun 2015 23:18:47 +0000]
Add constructor for CPDF_ColorSpace.

Prevents sub-classes from tweaking parent class instance vars.

Also "fix" https://code.google.com/p/pdfium/issues/detail?id=170, assuming 0 is a good value.

BUG=pdfium:170
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1185903002.

4 years agoMake CPDF_PageModuleDef and CPDF_RenderModuleDef pure virtual.
Lei Zhang [Tue, 16 Jun 2015 00:15:12 +0000]
Make CPDF_PageModuleDef and CPDF_RenderModuleDef pure virtual.

Get rid of the dummy implementations, which are never used when
the modules have been initialized.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1177383003.

4 years agoDo some IWYU cleanups.
Lei Zhang [Mon, 15 Jun 2015 23:44:14 +0000]
Do some IWYU cleanups.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1176333002.

4 years agoProvide a constructor for CPDF_CountedObject.
Tom Sepez [Mon, 15 Jun 2015 23:43:26 +0000]
Provide a constructor for CPDF_CountedObject.

Make members protected and remove external manipulations.
Move "*" into template since its always an indirection.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1182903002.

4 years agoRemove some dead code.
Lei Zhang [Mon, 15 Jun 2015 18:45:48 +0000]
Remove some dead code.

Review URL: https://codereview.chromium.org/1186673005.

4 years agoFix -Winconsistent-missing-override warnings.
Lei Zhang [Mon, 15 Jun 2015 18:41:44 +0000]
Fix -Winconsistent-missing-override warnings.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1187463003.

4 years agoRemove unneeded checks in CPDF_DocPageData::GetFontFileStreamAcc().
Lei Zhang [Sat, 13 Jun 2015 02:14:11 +0000]
Remove unneeded checks in CPDF_DocPageData::GetFontFileStreamAcc().

The input cannot be null. Same for CPDF_Document::LoadFontFile().

Also set the contract for CPDF_Document::LoadFont() and adjust callers
accordingly.

Also remove unused CPDF_Document::FindFont().

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1184673002.

4 years agoCorpus tests check for unexpected successes.
Tom Sepez [Fri, 12 Jun 2015 16:11:00 +0000]
Corpus tests check for unexpected successes.

Update run_corpus_tests.py to always run all test cases, and just
ignore the results that are supposed to fail.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1178393002.

4 years agoRemove trailing whitespaces in core.
Lei Zhang [Thu, 11 Jun 2015 22:17:59 +0000]
Remove trailing whitespaces in core.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1177973008.

4 years agoRemove unused reflow code.
Lei Zhang [Thu, 11 Jun 2015 21:59:16 +0000]
Remove unused reflow code.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1181803002.

4 years agoRemove trailing whitespaces in fpdfsdk.
Lei Zhang [Thu, 11 Jun 2015 21:00:52 +0000]
Remove trailing whitespaces in fpdfsdk.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1173343004.

4 years agoCorrect unexpected hinting fonts
Tom Sepez [Thu, 11 Jun 2015 20:25:12 +0000]
Correct unexpected hinting fonts

If the font is 'tricky', it needs to be hinted by default according to the description in freetype.

BUG=490814
R=tsepez@chromium.org

Committed: https://pdfium.googlesource.com/pdfium/+/7a2fcd8d1256c267380b40f2d2d8e98c3b181cee

Review URL: https://codereview.chromium.org/1170313003.

4 years agoCleanup: Get this rid of "this->" in fpdfsdk/
Lei Zhang [Thu, 11 Jun 2015 20:03:09 +0000]
Cleanup: Get this rid of "this->" in fpdfsdk/

Also remove commented out code and trailing whitespaces.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1179653005.

4 years agoKill FXSYS_mem{cpy,cmp,set.move}{32,8}.
Tom Sepez [Thu, 11 Jun 2015 19:05:04 +0000]
Kill FXSYS_mem{cpy,cmp,set.move}{32,8}.

At one point in time, it may have made sense to indicate the
expected alignment of the memory you're about to copy, but that
was last century. The compiler will take care of it just fine.

I stopped short of removing the FXSYS_ wrapper macros entirely.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1179693003.

4 years agoCleanup: Remove uses of "this->" in core/
Lei Zhang [Thu, 11 Jun 2015 06:33:26 +0000]
Cleanup: Remove uses of "this->" in core/

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1173223002.

4 years agoConvert CPDF_FontFileMap to std::map.
Lei Zhang [Thu, 11 Jun 2015 02:24:29 +0000]
Convert CPDF_FontFileMap to std::map.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1144333008.

4 years agoConvert CPDF_IccProfileMap to use std::map.
Lei Zhang [Thu, 11 Jun 2015 02:23:32 +0000]
Convert CPDF_IccProfileMap to use std::map.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1143133008.

4 years agoRemove FX_BSTR and FX_WSTR typedefs.
Tom Sepez [Wed, 10 Jun 2015 23:51:15 +0000]
Remove FX_BSTR and FX_WSTR typedefs.

These stand for const CFX_{Byte,Wide}StringC&, which is just
monumentally confusing, since there are so many string types
running around here.

The following had manual changes:
core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
core/src/fpdfdoc/doc_form.cpp
fpdfsdk/src/fpdf_ext.cpp

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1180593004.

4 years agoFix font rendering issues because of an incorrect transform.
John Abd-El-Malek [Wed, 10 Jun 2015 22:44:42 +0000]
Fix font rendering issues because of an incorrect transform.

This regressed in https://pdfium.googlesource.com/pdfium/+/71c24b839498fb89184002ed30fcff353e1e402c. The code would reach into FreeType internals and reset transform_flags. This would effectively set the font's transform matrix to the identity (since a transform is only used if the flag is set). I removed it because I assumed this is only a cache, and any other place that would call FT_Load_Glyph would have set a transform first. Apparently that's not the case (verified through adding some additional code). The fix is to reset the transform matrix after changing it. This is functionally equivalent to the previous behavior, since if the flag was 0 but there was a transform, it would be ignored until another transform is set.

BUG=479434
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1163423005.

4 years agoConvert CPDF_ImageMap to std::map.
Lei Zhang [Wed, 10 Jun 2015 22:25:22 +0000]
Convert CPDF_ImageMap to std::map.

Also simplify CPDF_DocPageData::ReleaseIccProfile() since its first
argument is always null.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1149273004.

4 years agoCache the CPDF_Annot's subtype, since it should never changes.
Lei Zhang [Wed, 10 Jun 2015 20:29:24 +0000]
Cache the CPDF_Annot's subtype, since it should never changes.

BUG=495300
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1178513002.

4 years agoConvert CPDF_PatternMap to std::map.
Lei Zhang [Wed, 10 Jun 2015 20:18:06 +0000]
Convert CPDF_PatternMap to std::map.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1162123004.

4 years agoCleanup: Remove CFFL_IFormFiller::GetCommitKey() that always returns 0.
Lei Zhang [Wed, 10 Jun 2015 18:47:08 +0000]
Cleanup: Remove CFFL_IFormFiller::GetCommitKey() that always returns 0.

Remove callers and related code that all just pass zeros around.

Also remove CFFL_IFormFiller::GetKeyDown().

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1149623012.

4 years agoConvert CPDF_ColorSpaceMap to std::map.
Lei Zhang [Wed, 10 Jun 2015 18:32:54 +0000]
Convert CPDF_ColorSpaceMap to std::map.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1154963003.

4 years agoRemove typdefs for pointer types in fx_system.h.
Tom Sepez [Wed, 10 Jun 2015 18:09:44 +0000]
Remove typdefs for pointer types in fx_system.h.

This involves fixing some multiple variable per line
declarations, as the textually-substituted "*" applies
only to the first one.

This involves moving some consts around following the
substitution.

This involves replacing some typedefs used as constructors
with better code.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1171733003

4 years agoConvert CPDF_FontMap to std::map.
Lei Zhang [Wed, 10 Jun 2015 17:40:57 +0000]
Convert CPDF_FontMap to std::map.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1151133004.

4 years agoRevert 'Correct unexpected hinting fonts'
JUN FANG [Tue, 9 Jun 2015 23:49:44 +0000]
Revert 'Correct unexpected hinting fonts'

TBR=tsepez@chromium.org

BUG=N/A

Review URL: https://codereview.chromium.org/1174583003

4 years agoCorrect unexpected hinting fonts
JUN FANG [Tue, 9 Jun 2015 23:28:53 +0000]
Correct unexpected hinting fonts

If the font is 'tricky', it needs to be hinted by default according to the description in freetype.

BUG=490814
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1170313003

4 years agoUse stdint.h types throughout PDFium.
Tom Sepez [Tue, 9 Jun 2015 18:30:25 +0000]
Use stdint.h types throughout PDFium.

It's redundant nowadays to provide our own equivalents, now
that this is done for us by the system header.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1177483002

4 years agoRemove more cruft from fx_system.h
Tom Sepez [Tue, 9 Jun 2015 00:25:42 +0000]
Remove more cruft from fx_system.h

- include system headers first and alphabetize.
- remove unsupported FX_WIN32_MOBILE symbol.
- actually define  a FX_WIN64 symbol and make consistent.
- use final/override, not FX_FINAL.
- let stdint.h resolve FX_WORDSIZE concerns.
- unused FX_ERR and FX_SUCCESS() macros.
- unused FX_LSB_FIRST macro.
- outline FX type deprecation plan.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1169963003

4 years agoFix potentially massive memory leak in CPDF_DIBSource::LoadJpxBitmap().
Lei Zhang [Mon, 8 Jun 2015 20:24:48 +0000]
Fix potentially massive memory leak in CPDF_DIBSource::LoadJpxBitmap().

Leaks can happen in several places. For this particular bug, it happens
when there is a colorspace component count mismatch.

BUG=497191
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1153633009

4 years agoCleanup: Make CPDF_Annot::m_pAnnotDict private.
Lei Zhang [Fri, 5 Jun 2015 22:28:03 +0000]
Cleanup: Make CPDF_Annot::m_pAnnotDict private.

Remove dead code in CPDF_Annot as well.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1157773012

4 years agoAdd move constructor for FX string types.
Tom Sepez [Fri, 5 Jun 2015 22:23:50 +0000]
Add move constructor for FX string types.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1162203007

4 years agoStandalone checkout gets buildtools.
Tom Sepez [Fri, 5 Jun 2015 20:34:44 +0000]
Standalone checkout gets buildtools.

This will pull in the checkdeps utility for standalone builds.
Write some include rules, too.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1149623011

4 years agoFix bad include path in fpdfview.cpp
Tom Sepez [Fri, 5 Jun 2015 20:24:21 +0000]
Fix bad include path in fpdfview.cpp

Caught by checkdeps rules.  That this still compiled is probably due to
some stray -I flag somewhere.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1149213008

4 years agoMove fx_safe_types.h to include/ directory.
Tom Sepez [Fri, 5 Jun 2015 01:53:39 +0000]
Move fx_safe_types.h to include/ directory.

Small bit of OCD here, since this file is included cross-library
(i.e. from fpdfsk), it can't be in src/.  In other words, the
following should be empty:
    grep -R 'include.*core/src/' fpdfsdk

Fix some IWYU in it at the same time.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1147353006

4 years agoKill unused IPDF_ classes.
Tom Sepez [Wed, 3 Jun 2015 23:09:12 +0000]
Kill unused IPDF_ classes.

Some are simply never defined.  Some are never instantiated.  Some have
paths that are never reached.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1168503003

4 years agoFix fx_basic_memmgr_unittest.cpp under stricter GN rules
Tom Sepez [Wed, 3 Jun 2015 19:05:33 +0000]
Fix fx_basic_memmgr_unittest.cpp under stricter GN rules

This caused a revert of the PDFium roll.

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1165863003

4 years agoAutomated test case for 487928.
Tom Sepez [Tue, 2 Jun 2015 23:51:07 +0000]
Automated test case for 487928.

Reproducing this bug requires the embedder to fire timers, something the
single-pass pdfium-test binary doesn't do properly at the present. So
we modify the embedder test delegate to allow the immediate triggering
of the same.

Perform some cleanup along the way by removing EmbedderTestDefaultDelegate
-- it buys us nothing over the the no-op one.

And, of course, v8 initialization is busted again, and we need v8 here.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1153213004

4 years agoFix windows compile: fix size_t vs. int mismatch
Tom Sepez [Tue, 2 Jun 2015 22:34:19 +0000]
Fix windows compile: fix size_t vs. int mismatch

As indicated by:
http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/63417/steps/compile%20%28with%20patch%29/logs/stdio

R=thestig@chromium.org
TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1160293003

4 years agokill IPDF_DocParser().
Tom Sepez [Tue, 2 Jun 2015 21:19:00 +0000]
kill IPDF_DocParser().

Its fine to program to interfaces, but since the sole concrete implementation
is in the same header as the interface, the code is bypassing it anyways. We
can de-virtualize some things along the way, and remove two non-existent
function prototypes from one of the headers.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1158053003

4 years agoFix heap use after free in Document::DoFieldDelay and Document::delay
Tom Sepez [Tue, 2 Jun 2015 17:09:49 +0000]
Fix heap use after free in Document::DoFieldDelay and Document::delay

This fix removes CJS_DelayData object from m_DelayData array and copies them to
a new array, before processing them. So contents of m_DelayData array cannot be
used after they get freed.

BUG=487928

R=tsepez@chromium.org

TEST= Chrome pdf plugin should not crash when poc_stable,testuafdocument1.pdf
      and testuafdocument2.pdf are viewed.
      see crbug.com/487928 and crbug.com/487928#c18 for more details.

Review URL: https://codereview.chromium.org/1163823002

4 years agoAdd missing comma to third_party.gyp
Bruce Dawson [Mon, 1 Jun 2015 21:44:52 +0000]
Add missing comma to third_party.gyp

A reference to nonstd_unique_ptr.h was added with
https://codereview.chromium.org/1091283002 but a comma is missing
after it. This causes this string to be concatenated with the next,
leading to broken sources. This went unnoticed by the build due to
the fact that the affected sources are both headers, but they should
be properly separated.

R=brucedawson@chromium.org

Review URL: https://codereview.chromium.org/1156663006

4 years agoRun V8 in predictable mode for pdfium_test
Jochen Eisinger [Fri, 29 May 2015 08:22:32 +0000]
Run V8 in predictable mode for pdfium_test

This won't post tasks to the background threads

BUG=none
R=kcc@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1157123003

4 years agoFix suppressions for 2015-05-28 drop
Tom Sepez [Thu, 28 May 2015 21:26:49 +0000]
Fix suppressions for 2015-05-28 drop

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1154993003

4 years agoRoll DEPS to pick up 2015-05-28 corpus drop.
Tom Sepez [Thu, 28 May 2015 21:00:30 +0000]
Roll DEPS to pick up 2015-05-28 corpus drop.

This will undoubtedly RED the tree due to differences in platforms
and environments.  A subsequent CL will add suppressions to get back
to GREEN.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1153393004

4 years agoFix ALL the include guards.
Tom Sepez [Thu, 28 May 2015 20:09:35 +0000]
Fix ALL the include guards.

Get rid of leading _CAPITAL identifiers.
A large number of these didn't actually match the filename.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1160443004

4 years agoRemove rendundant ../include from paths of files in include/ directory
Tom Sepez [Wed, 27 May 2015 23:07:42 +0000]
Remove rendundant ../include from paths of files in include/ directory

Tiny bit of tidying I noticed while trying to figure out include rules.

In other words,
   cd core/include
   git grep 'include.*include'
   git grep 'include.*src'

Should produce no output, and

   cd fpdfsdk/include
   git grep 'include.*include' | grep -v ../core/include
   git grep 'include.*src'

Should produce no output as well.

Fix some IWYU, header guards, include ordering, whitespace along the way.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1162453003

4 years agoUpgrade openjpeg to r3002
JUN FANG [Tue, 26 May 2015 19:14:39 +0000]
Upgrade openjpeg to r3002

BUG=459215
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1160663002

4 years agoUpdate copy of safe_math_impl.h to take a fix from upstream:
Tom Sepez [Thu, 21 May 2015 22:08:17 +0000]
Update copy of safe_math_impl.h to take a fix from upstream:

Fix a division by zero when multiplying 0 * y with SafeNumerics.

BUG=488302
R=jschuh@chromium.org

Review URL: https://codereview.chromium.org/1126243007

4 years agoFix four annoying warnings:
Tom Sepez [Thu, 21 May 2015 21:54:17 +0000]
Fix four annoying warnings:
Two "set but unused", one of which is surely an artifact from
copying code around, and the other which ought to be used for
the sake of clarity.

Two are unknown "optimize" pragmas, remove them since the code
has been shipped for years on other platforms under full optimization.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1148353002

4 years agoFix an endless loop in CJBig2_HuffmanTable::parseFromCodedBuffer
JUN FANG [Thu, 21 May 2015 16:56:11 +0000]
Fix an endless loop in CJBig2_HuffmanTable::parseFromCodedBuffer

This issue is trigged by the conversion from unsigned int to signed int.
A large unsigned int is converted to int. It's represented as a negative
int which is used in the condition of while later.

BUG=482639
R=brucedawson@chromium.org

Review URL: https://codereview.chromium.org/1146913003

4 years agoGet test running scripts to detect and report common error.
Bruce Dawson [Wed, 20 May 2015 23:52:05 +0000]
Get test running scripts to detect and report common error.

testing/tools/run_corpus_tests.py assumes a debug build and will
fail cryptically if only a release build is available.

Arguably there shouldn't be a default because having one could lead
to accidentally running a stale version, but that is probably too
much of a change.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1150823003

4 years agoInteger overflow in CJBig2_Image::expand
JUN FANG [Wed, 20 May 2015 19:25:56 +0000]
Integer overflow in CJBig2_Image::expand

1. New size should be larger than old size in JBig2_Realloc.
2. Arguments are integers but parameters are size_t in JBIG2_memset.
   After integer overflows, it will be presented as a huge
   unsigned number on 64 bits system.

BUG=483981
R=brucedawson@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1148643002

4 years agoTidy public fpdfview.h and fpdf_flatten.h.
Tom Sepez [Wed, 20 May 2015 17:00:19 +0000]
Tidy public fpdfview.h and fpdf_flatten.h.

Mostly cosmetic; fix a spelling error, make comment style
consistent, remove unnecessary #ifdefs, remove unused globals.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1139993003