pdfium.git
4 years agoXFA: merge patch from CL 815103002
Bo Xu [Fri, 19 Dec 2014 22:29:17 +0000]
XFA: merge patch from CL 815103002

Update freetype to 2.5.4.

Put freetype into third_party directory, cleaning up header files.

Previously freetype header files are in core/src/fxge/freetype and core/include/thirdparties. There were also multiple fx_freetype.h.

This patch removes the additional Foxit wrapper to make further update easier.

Notice, for original freetype source code, the following files are modified and need to be updated accordingly in future update:

third_party/freetype/include/config/ftmodule.h
third_party/freetype/include/config/ftoption.h

BUG=407341
R=thestig@chromium.org

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

4 years agoXFA: merge patch from CL 817753002
Bo Xu [Fri, 19 Dec 2014 10:27:25 +0000]
XFA: merge patch from CL 817753002

Fix a few windows compile warnings

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 810223003
Lei Zhang [Thu, 18 Dec 2014 22:03:45 +0000]
XFA: merge patch from CL 810223003

Cleanup: Refactor some code into its own function in fpdf_text_int.cpp.

Also use stdlib algorithms in a few places.

R=tsepez@chromium.org

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

Conflicts:
core/src/fpdftext/fpdf_text_int.cpp

4 years agoXFA: merge patch from CL 816593002
Lei Zhang [Thu, 18 Dec 2014 04:10:00 +0000]
XFA: merge patch from CL 816593002

Cleanup: Remove a shadow variable in CPDF_TextPage::CloseTempLine().

R=bo_xu@foxitsoftware.com

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

4 years agoXFA: merge patch from CL 761313004
Bo Xu [Thu, 18 Dec 2014 01:51:00 +0000]
XFA: merge patch from CL 761313004

Add a small LRU cache for the JBIG2 symbol dictionary.

This reduces rendering time on my test document by over
10 seconds. It is super common for a JBIG2 dictionary to
span multiple pages, so we don't want to decode the same
dictionary over and over again.

Original patch from Jeff Breidenbach (breidenbach@gmail.com)

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

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

4 years agoXFA: merge patch from CL 790213005
Lei Zhang [Thu, 18 Dec 2014 00:54:04 +0000]
XFA: merge patch from CL 790213005

Cleanup: Pass by const reference in fpdftext.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from CL 441988
Bruce Dawson [Sat, 13 Dec 2014 05:30:37 +0000]
XFA: merge patch from CL 441988

Avoid duplicate definitions of JSCONST_n*Hash and QeTable variables.

QeTable is a 752 byte array that was defined in a header file. This
caused it to be instantiated by the VC++ compiler 12 times, wasting
8,272 bytes of space in the data segment. Because 'const' implies
'static' this did not cause any duplicate symbol errors.

JSCONST_n*HASH are a set of eight variables that are defined in a header
file. This causes them to be replicated 15 times. The variables
themselves are tiny but they are dynamically initialized and this
dynamic initialization code is replicated 15 times.

When tested on pdfium_test.exe the effect of this change is to:
Reduce the .text (code) segment by 3,616 bytes.
Reduce the .rdata section by 8,656 bytes.
Reduce the total binary file size by 13312 bytes.

These are the worst offenders for pdf.dll as shown in:
https://drive.google.com/open?id=1BvubxoA2SU_2e4T5cq7jHTjc1TlT0qOndpIfX3DMeA8&authuser=0

This will also drastically simplify the list of work to be done
for bug 441899 (getting rid of initializers).

BUG=441988
R=bo_xu@foxitsoftware.com

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

4 years agoRemove spurious XFA unsupported warning on XFA branch
Tom Sepez [Thu, 18 Dec 2014 23:13:46 +0000]
Remove spurious XFA unsupported warning on XFA branch

R=bo_xu@foxitsoftware.com

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

4 years agoFix obvious compilation breakage on win32 in previous version.
Tom Sepez [Thu, 18 Dec 2014 19:14:19 +0000]
Fix obvious compilation breakage on win32 in previous version.

TBR=thestig@chromium.org

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

4 years agoInitialize V8 external data (XFA version).
Tom Sepez [Thu, 18 Dec 2014 00:24:01 +0000]
Initialize V8 external data (XFA version).

This is a quick patch to fix the segv which occurs in pdfium_test when
the v8 external data is not provided.  Fixing the full-up initialization
is left as a follow-on exercise.

Path manipulations remain a nuisance since we don't want to depend on a
particular /base library.

BUG=439793
R=thestig@chromium.org

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

4 years agoXFA: merge patch from issue 803103002
JUN FANG [Wed, 17 Dec 2014 21:58:56 +0000]
XFA: merge patch from issue 803103002

Before this fix, the root will be released when an indirect object has the
same object number with the root. However, the root object is loaded when
the trailer is parsed. It shall not be updated or replaced anymore.

BUG=425040
R=tsepez@chromium.org

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

4 years agoRemove more defines in XFA branch that aren't used for PDFium.
John Abd-El-Malek [Mon, 15 Dec 2014 21:35:58 +0000]
Remove more defines in XFA branch that aren't used for PDFium.

R=tsepez@chromium.org

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

4 years agoXFA: merge patch from issue 801913002 and 804463003
John Abd-El-Malek [Mon, 15 Dec 2014 20:13:45 +0000]
XFA: merge patch from issue 801913002 and 804463003

Simplify PDFium by removing code that's not used in the open source repo.

-remove parameter from FPDF_InitLibrary
-remove a bunch of ifdefs that are unused

Fix build after previous commit.

TBR=tsepez@chromium.org
BUG=

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

5 years agoMerge to XFA: patch from CL 792113003
Bo Xu [Thu, 11 Dec 2014 22:24:35 +0000]
Merge to XFA: patch from CL 792113003

m_pColorSpace can not be NULL for image object with DCTDecode filter

BUG=411842
R=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 790363002
Bo Xu [Thu, 11 Dec 2014 00:45:46 +0000]
Merge to XFA: patch from CL 790363002

Do not do strict check of BitsPerComponent for RunLengthDecode filter

BUG=438421
R=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 791223002
Bo Xu [Thu, 11 Dec 2014 00:00:29 +0000]
Merge to XFA: patch from CL 791223002

Lab colorspace needs to be 3 component

BUG=429134
R=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 787753002
Bo Xu [Tue, 9 Dec 2014 18:13:59 +0000]
Merge to XFA: patch from CL 787753002

Trailer should be a dictionary object

BUG=https://code.google.com/p/pdfium/issues/detail?id=86

a "<<" token should follow "trailer" but "<" will trick the parser to make trailer a hex string object.

R=tsepez@chromium.org

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

5 years agoMake app.alert() actually print its message under pdfium_test.
Tom Sepez [Mon, 8 Dec 2014 17:55:11 +0000]
Make app.alert() actually print its message under pdfium_test.

This is needed as an aid to testing.

R=thestig@chromium.org

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

5 years agocheck NULL of pTemplateRoot in DoDataMerge
Bo Xu [Sat, 6 Dec 2014 01:20:03 +0000]
check NULL of pTemplateRoot in DoDataMerge

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

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

5 years agoLog message when XFA load fails
Tom Sepez [Fri, 5 Dec 2014 21:30:51 +0000]
Log message when XFA load fails

A minor change to make it obvious when generated/test XFA files are not
being fully processed.

R=bo_xu@foxitsoftware.com

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

5 years agoRemove needless casts of (narrow) string literals.
Tom Sepez [Thu, 4 Dec 2014 18:10:34 +0000]
Remove needless casts of (narrow) string literals.

Follow-up to work on (wide) string literals.

R=bo_xu@foxitsoftware.com

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

5 years agoReplace void* pointers with CFX_BaseMassArrayImp* pointers.
Tom Sepez [Thu, 4 Dec 2014 17:54:14 +0000]
Replace void* pointers with CFX_BaseMassArrayImp* pointers.

Using an incomplete type here avoids casting later on, and allows the
debugger to more easily dig through these data structures.

R=bo_xu@foxitsoftware.com

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

5 years agoMerge "Add big integer library""
Bo Xu [Tue, 2 Dec 2014 21:06:22 +0000]
Merge "Add big integer library""

This patch merges the 3 commits in master branch into one

5 years agoMass remove dangerous and needless LPCWSTR casts.
Tom Sepez [Mon, 24 Nov 2014 23:55:20 +0000]
Mass remove dangerous and needless LPCWSTR casts.

One table is also reformatted to put one entry per line for readability.

R=bo_xu@foxitsoftware.com

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

5 years agoMerge to XFA: patch from CL 758593002
Bo Xu [Mon, 24 Nov 2014 21:58:10 +0000]
Merge to XFA: patch from CL 758593002

Update to openjpeg r2944

BUG=429139,430566,431288
R=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 743263002
Jun Fang [Thu, 20 Nov 2014 02:58:01 +0000]
Merge to XFA: patch from CL 743263002

Fix blank page issues caused by too strict check

Before this fix, PDF parser aborts the parsering process when detecting an error.
For this case, PDF parser just gives up parsering when it detects that the length of
image stream is incorrect. The solution to this case is to find the tag "endstream"
and "endobj" to calculate the length rather than aborting the parsering process.

BUG=433339
R=tsepez@chromium.org

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

5 years agoAdd XFA test files
Bo Xu [Wed, 19 Nov 2014 00:57:44 +0000]
Add XFA test files

R=tsepez@chromium.org

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

5 years agoUpdate form fill version to 2 for pdfium_test.cc on XFA branch (only).
Tom Sepez [Tue, 18 Nov 2014 22:10:25 +0000]
Update form fill version to 2 for pdfium_test.cc on XFA branch (only).

BUG=https://code.google.com/p/pdfium/issues/detail?id=82
R=bo_xu@foxitsoftware.com

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

5 years agoMerge to XFA: patch from CL 738433003
Bruce Dawson [Tue, 18 Nov 2014 21:42:28 +0000]
Merge to XFA: patch from CL 738433003

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

R=tsepez@chromium.org
TBR=tsepez@chromium.org

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

5 years agoMerge to XFA: patch from CL 730993002
Bo Xu [Mon, 17 Nov 2014 18:46:25 +0000]
Merge to XFA: patch from CL 730993002

5 years agoMerge to XFA: patch from CL 700373006 and 727243002
Bo Xu [Sat, 15 Nov 2014 01:40:50 +0000]
Merge to XFA: patch from CL 700373006 and 727243002

5 years agoMerge to XFA: Patch from CL 726143002
Bo Xu [Sat, 15 Nov 2014 01:03:50 +0000]
Merge to XFA: Patch from CL 726143002

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

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

5 years agoCheck NULL pointer dereferencing from GetDirect
Bo Xu [Sat, 15 Nov 2014 01:22:13 +0000]
Check NULL pointer dereferencing from GetDirect

BUG=431770
R=tsepez@chromium.org

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

5 years agoMerge to XFA: Patch from CL 705503004
Bo Xu [Fri, 14 Nov 2014 22:18:05 +0000]
Merge to XFA: Patch from CL 705503004

Change from 'this' to L'this' and remove the cast that was hiding this mismatch.

Found by VC++'s /analyze. Warning was:

fpdfsdk\src\javascript\js_runtime.cpp(352) : warning C6276:
Cast between semantically different string types:  char * to wchar_t *.
Use of invalid string can lead to undefined behavior.

This mismatch has been there as far back as the history goes (to May of this year).

It looks like a real bug to me. However I don't know the implications of this bug and why it would not have been noticed at run-time.

The code has been this way as far back as the git history goes, but that is only to May 2014.

Original patch from Bruce Dawson(brucedawson@chromium.org)

BUG=427616
R=bo_xu@foxitsoftware.com

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

5 years agoAdd XFA files to GN build.
Tom Sepez [Fri, 14 Nov 2014 21:39:20 +0000]
Add XFA files to GN build.

This mirrors the changes made to .gyp files on the XFA branch. Chrome is
still building against the master branch, so the only meaningful way
to test this is locally.

R=dpranke@chromium.org

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

5 years agoXFA: merge patch from issue 726033002
Tom Sepez [Fri, 14 Nov 2014 19:56:27 +0000]
XFA: merge patch from issue 726033002

Fixes android build error under stricter compilation modes.

TBR=bo_xu@foxitsoftware.com

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

5 years agoMerge patch from issue 720193004 to XFA.
Tom Sepez [Fri, 14 Nov 2014 01:04:15 +0000]
Merge patch from issue 720193004 to XFA.

Adds GN build capability for pdfium_test.
TBR=dpranke@chromium.org

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

5 years agoMerge to XFA: patch from CL 618073003
Bo Xu [Mon, 10 Nov 2014 21:34:05 +0000]
Merge to XFA: patch from CL 618073003

BUG=401988
R=vitalybuka@chromium.org

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

5 years agoCorrect the forminfo version check in pdfium
Bo Xu [Sat, 8 Nov 2014 01:09:07 +0000]
Correct the forminfo version check in pdfium

5 years agoChange version of FPDF_FORMFILLINFO to 2; Add #define PDF_USE_XFA
Bo Xu [Fri, 7 Nov 2014 00:13:33 +0000]
Change version of FPDF_FORMFILLINFO to 2; Add #define PDF_USE_XFA

5 years agoMerge to XFA: patch from CL 703213004
Tom Sepez [Thu, 6 Nov 2014 23:03:46 +0000]
Merge to XFA: patch from CL 703213004

Fix bug with reading from uninitialized variable found by VC++'s /analyze.

The flag variable is conditionally initialized but unconditionally read.

Warning was:
src\fpdfapi\fpdf_page\fpdf_page_pattern.cpp(274) : warning C6001:
Using uninitialized memory 'flag'.

BUG=427616
R=tsepez@chromium.org

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

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

5 years agoMerge to XFA: patch from issue 692533005
Tom Sepez [Thu, 6 Nov 2014 22:45:35 +0000]
Merge to XFA: patch from issue 692533005

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

5 years agoRemove xfa_test for delivery
Bo Xu [Tue, 4 Nov 2014 02:38:41 +0000]
Remove xfa_test for delivery

5 years agomodify google bug 61311 for messageBox;
linlin_miao [Fri, 31 Oct 2014 02:10:33 +0000]
modify google bug 61311 for messageBox;
61750 for dateField input "aaa" not dislpay;
update font map;

5 years agoUpdate CloseDocument and ExitForm
xiaoxia_yu [Thu, 30 Oct 2014 02:36:45 +0000]
Update CloseDocument and ExitForm

5 years agoDo not Initialize v8 in fpdfsdk, since this has been done in xfa
Bo Xu [Wed, 29 Oct 2014 23:12:02 +0000]
Do not Initialize v8 in fpdfsdk, since this has been done in xfa

5 years agoLock page in LoadFXAnnot to prevent unintended page closing
unknown [Wed, 29 Oct 2014 11:37:24 +0000]
Lock page in LoadFXAnnot to prevent unintended page closing

5 years agoRemove unused variable in pdfium_engine.cc
Bo Xu [Wed, 29 Oct 2014 06:24:51 +0000]
Remove unused variable in pdfium_engine.cc

5 years agoMerge XFA to PDFium master at 4dc95e7 on 10/28/2014
Bo Xu [Wed, 29 Oct 2014 06:03:33 +0000]
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014

5 years agoUndo an old change in freetype to account for size of USHORT
Bo Xu [Thu, 30 Oct 2014 23:02:56 +0000]
Undo an old change in freetype to account for size of USHORT

BUG=418582
R=tsepez@chromium.org

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

5 years agoFor v8 Global Object, do not copy in CJS_Value constructor.
Tom Sepez [Thu, 30 Oct 2014 20:23:42 +0000]
For v8 Global Object, do not copy in CJS_Value constructor.

BUG=425129
R=bo_xu@foxitsoftware.com

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

5 years agoUpdate openjpeg to r2920
Bo Xu [Thu, 30 Oct 2014 20:10:50 +0000]
Update openjpeg to r2920

BUG=414036, 425151
R=tsepez@chromium.org

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

5 years agoResolve compilation error with G++ 4.9.
Tom Sepez [Wed, 29 Oct 2014 22:31:20 +0000]
Resolve compilation error with G++ 4.9.

Add a check for zero-length keys to avoid hitting the equivalent of |""[1]|.
BUG=https://code.google.com/p/pdfium/issues/detail?id=58
R=jun_fang@foxitsoftware.com

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

5 years agoupdate openjpeg to r2911
Bo Xu [Wed, 22 Oct 2014 22:32:43 +0000]
update openjpeg to r2911

BUG=418976, 425150, 414525
R=tsepez@chromium.org

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

5 years agoChange the clear order of pDocPage and pDocRender
Bo Xu [Tue, 21 Oct 2014 21:50:16 +0000]
Change the clear order of pDocPage and pDocRender

pTransfer function is released in pDocRender cleanup but is still being accessed in
~CPDF_GeneralStateData in pDocPage cleanup.

BUG=419320
R=tsepez@chromium.org

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

5 years agoUpdate openjpeg to r2908
Bo Xu [Tue, 21 Oct 2014 20:05:17 +0000]
Update openjpeg to r2908

BUG=414089, 414310, 414606
R=tsepez@chromium.org

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

5 years agoMore fixes in sycc422_to_rgb and sycc420_to_rgb when image width is odd
Bo Xu [Tue, 21 Oct 2014 19:17:39 +0000]
More fixes in sycc422_to_rgb and sycc420_to_rgb when image width is odd

This patch is supplementary to issue 418881

R=tsepez@chromium.org

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

5 years agoAdd missing parenthesis in FXARGB_GETDIB macro
Bo Xu [Tue, 21 Oct 2014 19:04:41 +0000]
Add missing parenthesis in FXARGB_GETDIB macro

You can get warning when using FXARGB_GETDIB() with & operation in
the same statement like: FXARGB_GETDIB(src_scan) & 0xffffff in
fx_dib_composite.cpp:

../../third_party/pdfium/core/src/fxge/dib/fx_dib_composite.cpp:737:205:
error: '&' within '|' [-Werror,-Wbitwise-op-parentheses]

Original patch from jiangj@opera.com

R=thakis@chromium.org

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

5 years agoMake DEPS not add an extra pdfium directory.
John Abd-El-Malek [Thu, 16 Oct 2014 22:32:26 +0000]
Make DEPS not add an extra pdfium directory.

This makes gclient config and gclient sync work.

BUG=423896
TBR=aneeshm@chromium.org

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

5 years agoFix standalone build on Linux and Mac.
John Abd-El-Malek [Thu, 16 Oct 2014 21:26:18 +0000]
Fix standalone build on Linux and Mac.

BUG=423883
R=scottmg@chromium.org

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

5 years agoFix licenses in headers to pass Chromium's checklicenses tool.
Tom Sepez [Wed, 15 Oct 2014 17:16:45 +0000]
Fix licenses in headers to pass Chromium's checklicenses tool.

This is a re-landing of the changes in https://pdfium.googlesource.com/pdfium/+/6387aff
which were lost during a libopenjpeg library roll.

TBR=thestig@chromium.org

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

5 years agoStore the address of the page data map's value for proper referencing.
Bo Xu [Wed, 15 Oct 2014 00:10:06 +0000]
Store the address of the page data map's value for proper referencing.

CPDF_Pattern objects are counted and maintained in m_PatternedMap.
When a CPDF_Pattern object "pattern" is deleted, it's address is marked as NULL in m_PatternMap.
This patch stores the address of CPDF_Pattern's adderss in all objects that references "pattern",
to ensure valid referencing after deletion.

BUG=416319, 419976, 418392
R=tsepez@chromium.org

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

5 years agoDon't leave dangling pointer to out-of-scope local in CPDF_StreamContentParser::Parse.
Tom Sepez [Tue, 14 Oct 2014 21:40:57 +0000]
Don't leave dangling pointer to out-of-scope local in CPDF_StreamContentParser::Parse.

This is just a bit of defensive programming; I'm not sure the situation can
occur in the current code, but the following code is likely to set off a red
flag to anyone who reads it:
    CPDF_StreamParser syntax(pData, dwSize);
    m_pSyntax = &syntax;
since the extent of the local |syntax| is far less than the pointer member
|m_pSyntax|.  NULL it out before syntax goes out of scope.

R=jun_fang@foxitsoftware.com

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

5 years agoGlyph index is out of range in cff_get_glyph_name.
Jun Fang [Tue, 14 Oct 2014 20:57:19 +0000]
Glyph index is out of range in cff_get_glyph_name.
Glyph index shall be less than number of glyphs.

BUG=418585
R=tsepez@chromium.org

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

5 years agoFix off-by-one in sizing of m_EmbeddedToUnicodes.
Tom Sepez [Mon, 13 Oct 2014 20:16:32 +0000]
Fix off-by-one in sizing of m_EmbeddedToUnicodes.

BUG=421196
R=bo_xu@foxitsoftware.com

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

5 years agoFix a bug when image width is odd in sycc422_to_rgb
Bo Xu [Fri, 10 Oct 2014 22:57:36 +0000]
Fix a bug when image width is odd in sycc422_to_rgb

BUG=418881
R=tsepez@chromium.org

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

5 years agoEnable C linkage in fpdfppo.h
Bo Xu [Fri, 3 Oct 2014 20:18:55 +0000]
Enable C linkage in fpdfppo.h

BUG=pdfium-52
R=jun_fang@foxitsoftware.com

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

5 years agocheck pointer overflow in t2.c
Bo Xu [Fri, 3 Oct 2014 19:29:54 +0000]
check pointer overflow in t2.c

BUG=413375
R=tsepez@chromium.org

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

5 years agoAdd openjpeg pre-processor OPJ_STATIC to pdfium.gyp
Bo Xu [Fri, 3 Oct 2014 18:06:35 +0000]
Add openjpeg pre-processor OPJ_STATIC to pdfium.gyp

Openjpeg removed the definition of OPJ_STATIC in openjpeg.h.
This change is merged in https://pdfium.googlesource.com/pdfium/+/d53e6fdb0a86ca1ddb12876a60f7f2d7508b5349
So need to add OPJ_STATIC to pdfium.gyp

BUG=None
R=tsepez@chromium.org

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

5 years agoUpdate openjpeg
Bo Xu [Tue, 30 Sep 2014 18:12:05 +0000]
Update openjpeg

BUG=407964, 414182, 413447
R=tsepez@chromium.org

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

5 years agoUse static_assert unconditionally.
Peter Kasting [Sat, 27 Sep 2014 01:09:20 +0000]
Use static_assert unconditionally.

BUG=none
TEST=none
R=jam@chromium.org

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

5 years agoRename GN public variables.
Brett Wilson [Wed, 24 Sep 2014 22:32:49 +0000]
Rename GN public variables.

forward_dependent_configs_from => public_deps
direct_dependent_configs => public_configs

R=jam@chromium.org

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

5 years agoLock page in LoadFXAnnot to prevent unintended page closing
Bo Xu [Wed, 24 Sep 2014 17:49:52 +0000]
Lock page in LoadFXAnnot to prevent unintended page closing

BUG=410326
R=tsepez@chromium.org

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

5 years agoInvoke V8::Initialize() explicitly during V8 setup
Jochen Eisinger [Mon, 22 Sep 2014 06:46:17 +0000]
Invoke V8::Initialize() explicitly during V8 setup

BUG=none
R=jam@chromium.org

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

5 years agoAdd FPDF_GetSecurityHandlerRevision
Bo Xu [Sat, 20 Sep 2014 02:16:31 +0000]
Add FPDF_GetSecurityHandlerRevision

Security handler revision number is needed to interpret file permission.

BUG=None
R=thestig@chromium.org

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

5 years agoFix a bug when assign the generation number of indirect objects
Bo Xu [Fri, 19 Sep 2014 22:58:46 +0000]
Fix a bug when assign the generation number of indirect objects

BUG=408532
R=tsepez@chromium.org

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

5 years agoAdjust the order of clearing resource in CPDF_DocPageData::Clear
Jun Fang [Fri, 19 Sep 2014 21:51:51 +0000]
Adjust the order of clearing resource in CPDF_DocPageData::Clear

Images are basic resource and are referred or used by other objects in some cases. Images should be released after the objects who uses these objects. In this case, an image object is accessed in the process of CPDF_TilingPattern's destroy. Unlikely, this image has been destroyed before.

BUG=414046
R=tsepez@chromium.org

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

5 years agoFix Regression: Incomplete file loading is seen for multi page pdf files.
Tom Sepez [Thu, 18 Sep 2014 19:11:56 +0000]
Fix Regression: Incomplete file loading is seen for multi page pdf files.

This was introduced at PDFium revision 12a9940. There was a subtle logic
change for null |parray|.

BUG=415438
R=jun_fang@foxitsoftware.com

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

5 years agogn: don't remove -fno-exceptions to match gyp
Scott Graham [Thu, 18 Sep 2014 16:28:58 +0000]
gn: don't remove -fno-exceptions to match gyp

Not required since: https://code.google.com/p/pdfium/issues/detail?id=28

R=jam@chromium.org
BUG=chromium:335824

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

5 years agoWhen forcing clear page data, no need to release colorspace when releasing pattern
Bo Xu [Tue, 16 Sep 2014 20:24:37 +0000]
When forcing clear page data, no need to release colorspace when releasing pattern

BUG=414661
R=tsepez@chromium.org

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

5 years agoAdd a boundary check before accessing the table of 'Index to Location'
Jun Fang [Tue, 16 Sep 2014 04:50:59 +0000]
Add a boundary check before accessing the table of 'Index to Location'

Before this fix, only |gindex < face->num_locations| is checked. However, the pointer, p, will be moved to next location in the first FT_NEXT_ULONG or FT_NEXT_USHORT. It may cause a crashier. So a boundary check is needed before the second FT_NEXT_ULONG or FT_NEXT_USHORT.

BUG=412457
R=tsepez@chromium.org

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

5 years agoCheck Null pointer in CPDF_Dictionary::GetUnicodeText
Bo Xu [Mon, 15 Sep 2014 18:28:25 +0000]
Check Null pointer in CPDF_Dictionary::GetUnicodeText

BUG=414155
R=thakis@chromium.org

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

5 years agoFix hebrew character highlight issue in a special document
Bo Xu [Thu, 11 Sep 2014 21:26:42 +0000]
Fix hebrew character highlight issue in a special document

There is an image object and text objects in this document, but the character in each text object is reversed.
When rendering, the image object is shown.
However, when highlighting, the text object is selected, resulting in text index issue.
Moreover, the character in the document is in reading order, which is different from normal document.

BUG=pdfium:43
R=jbreiden@google.com

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

5 years agoCheck object type for objects used in the dictory of 'Index'
Jun Fang [Wed, 10 Sep 2014 23:11:45 +0000]
Check object type for objects used in the dictory of 'Index'

BUG=387970
R=tsepez@chromium.org

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

5 years agoChange the forced clear order of CPDF_DocPageData::Clear, and remove m_pDocument...
Bo Xu [Wed, 10 Sep 2014 01:39:30 +0000]
Change the forced clear order of CPDF_DocPageData::Clear, and remove m_pDocument in CPDF_Color

If not forced clear, the counter of CPDF_Pattern will take care the count of referenced instance.
When forced clear, clear color first to make sure pattern still exists when referencing it.

BUG=411154
R=tsepez@chromium.org

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

5 years agoFix uninitialized value in CPDF_ColorStateData
Bo Xu [Wed, 10 Sep 2014 01:32:05 +0000]
Fix uninitialized value in CPDF_ColorStateData

BUG=411161
R=tsepez@chromium.org

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

5 years agoRevert of Fix uninitialized value in CPDF_ColorStateData (patchset #1 id:1 of https...
Bo Xu [Wed, 10 Sep 2014 00:36:01 +0000]
Revert of Fix uninitialized value in CPDF_ColorStateData (patchset #1 id:1 of https://codereview.chromium.org/547863002/)

Reason for revert:
The initialized member variable is wrong. Needs to undo this.

Original issue's description:
> Fix uninitialized value in CPDF_ColorStateData
>
> BUG=411161
> R=tsepez@chromium.org
>
> Committed: https://pdfium.googlesource.com/pdfium/+/a38d4c3572b566f8e64b9ca4f725cbbc581e85ab

TBR=tsepez@chromium.org,jun_fang@foxitsoftware.com
NOTREECHECKS=true
NOTRY=true
BUG=411161

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

5 years agoFix uninitialized value in CPDF_ColorStateData
Bo Xu [Tue, 9 Sep 2014 00:35:04 +0000]
Fix uninitialized value in CPDF_ColorStateData

BUG=411161
R=tsepez@chromium.org

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

5 years agoFix un-initialized R G B value
Bo Xu [Tue, 9 Sep 2014 00:28:16 +0000]
Fix un-initialized R G B value

BUG=411163
R=tsepez@chromium.org

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

5 years agoConvert GN visibility to be a list.
Brett Wilson [Mon, 8 Sep 2014 23:36:48 +0000]
Convert GN visibility to be a list.

GN visibility currently allows either string or list types, but this is causing
some problems for some templates. I'm going to require it to be lists, so am
changing all callers before pushing the new binary.

R=jam@chromium.org

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

5 years agoMerge performance fix for cmsDupToneCurve from previous upstream branch.
Chris Palmer [Mon, 8 Sep 2014 23:12:10 +0000]
Merge performance fix for cmsDupToneCurve from previous upstream branch.

BUG=
R=jun_fang@foxitsoftware.com

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

5 years agoThe cause of this issue is that there is an indirect object like '112 0 R' but no...
Jun Fang [Mon, 8 Sep 2014 18:27:02 +0000]
The cause of this issue is that there is an indirect object like '112 0 R' but no its direct object '112 0 object' in the test pdf file. Without checking the validity, it causes a null pointer when trying to get the direct object by an indirect object.

BUG=390781
R=tsepez@chromium.org

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

5 years agoAdd v8_platform to the JS dependencies in the GN build.
Brett Wilson [Thu, 4 Sep 2014 20:48:16 +0000]
Add v8_platform to the JS dependencies in the GN build.

This is required for the call to v8::platform::CreateDefaultPlatform.

R=jam@chromium.org

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

5 years agoAllocate m_pCompData when |m_nComponents| is updated.
Bo Xu [Wed, 3 Sep 2014 20:30:43 +0000]
Allocate m_pCompData when |m_nComponents| is updated.

When |m_nComponents| is changed from loading stream information,
previously allocated memory that depends on |m_nComponents| needes to be freed
and allocated again to enforce memory size consistency.

BUG=409695
R=tsepez@chromium.org

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

5 years agoCheck m_nComponents when using JBIG2Decode
Bo Xu [Tue, 2 Sep 2014 22:36:34 +0000]
Check m_nComponents when using JBIG2Decode

BUG=409692
R=tsepez@chromium.org

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

5 years agoAdd m_pDocument in CPDF_Color and check if page date has been forced clear
Bo Xu [Tue, 2 Sep 2014 19:13:36 +0000]
Add m_pDocument in CPDF_Color and check if page date has been forced clear

This will prevent using freed pattern object.
This is a better solution than https://pdfium.googlesource.com/pdfium/+/1b9c5c4dc41956b8c5ab17b9a882adf8a2513768
and in essence revert that patch

BUG=409373
R=tsepez@chromium.org

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

5 years agoTidy up opj_ callback functions in fx_codec_jpx_obj.cpp
Tom Sepez [Tue, 2 Sep 2014 17:27:47 +0000]
Tidy up opj_ callback functions in fx_codec_jpx_obj.cpp

This is code cleanup rather than bug fixing.

The motivation for this was to fix the casts at line 97 of the original file.  These are wrong; you cannot correct via casting a function signature mismatch when passing a function as an argument.  In theory, there's no reason to believe that the compiler will pass args in the same manner for a function of type (void*, size_t, void*) as for a function of type (void*, size_t, some_struct*).  The cast will suppress the compile error, but you can't be assured the call will work as intended.  In practice, it does, since the last architecture where a void* had a different representation than a struct* went extinct in the late 80s.

In the functions themselves, note that we currently bail out if srcData->offset >= srcData->src_size, so the expression
   bufferLength = (OPJ_SIZE_T)(srcData->src_size - srcData->offset)

will always be > 0.  Hence the check
   if(bufferLength <= 0)
is pointless, esp. since bufferLength is a signed type and < 0 makes no sense.

The opj_seek_from_memory() has a bool return value, so returning -1 on error doesn't seem reasonable.  Change this to TRUE/FALSE, and return false on seek past end.

If we're truly passing readonly data, then perhaps it makes sense to make the write() function always return -1. I didn't do this.

Lastly, I capitalize "DecodeData" so that it looks like a struct, and change its members to be size_t's to avoid casting back and forth.

R=jun_fang@foxitsoftware.com

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

5 years agoRemove the GetValidBpc check in application callers and move it to where m_bpc is...
Bo Xu [Sun, 31 Aug 2014 22:23:46 +0000]
Remove the GetValidBpc check in application callers and move it to where m_bpc is assigned.

The problem of using GetValidBpc() in each function call is it could result in mismatch as seen in this case:
in ContinueToLoadMask(), m_bpc is re-assigned to 1 if m_bImageMask==1 regardless of the value from GetValidBpc().
This will result in mismatch if another function use the value from GetValidBpc().

The solution could be checking m_bImageMask in another function to make sure m_bpc is consistent, but that makes the code too cumbersome.
Also, we have to bring and are bringing in more and more GetValidBpc check, and this will continue with other buggy documents. So better to fix it now.

The original rational to use GetValidBpc() in where m_bpc is used is to respect the "raw" data from parsing.
However, if it will be ignored anyway and using value from GetValidBpc(), we'd better correct it at the very beginning.

BUG=408541
R=tsepez@chromium.org

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

5 years agoRemove unused fields and stack locals.
Chris Palmer [Thu, 28 Aug 2014 21:44:46 +0000]
Remove unused fields and stack locals.

Edge closer to getting PDFium to build in chromium_code mode.

BUG=https://code.google.com/p/pdfium/issues/detail?id=29
R=bo_xu@foxitsoftware.com

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

5 years agoNo need to release resources in destructor of CPDF_ShadingObject
Bo Xu [Thu, 28 Aug 2014 18:49:17 +0000]
No need to release resources in destructor of CPDF_ShadingObject

CPDF_DocPageData::~CPDF_DocPageData() will force to release all resources, so no need to do it here, which can result in heap-use-after-free trouble.

BUG=408164
R=jun_fang@foxitsoftware.com, tsepez@chromium.org

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