pdfium.git
4 years agoRestrict index not be greater than row_size in TIFF_PredictLine
Bo Xu [Wed, 27 Aug 2014 23:01:41 +0000]
Restrict index not be greater than row_size in TIFF_PredictLine

There is not strict way to limit invalid value of |Colors| from dictionary. We can make sure |index| does not go out of boundary of row_size.

BUG=407614
R=tsepez@chromium.org

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

4 years agoUse valid bpc value in LoadPalette() and ContinueToLoadMask()
Bo Xu [Wed, 27 Aug 2014 21:19:55 +0000]
Use valid bpc value in LoadPalette() and ContinueToLoadMask()

BUG=408141, 408147
R=tsepez@chromium.org

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

4 years agoFix a bug when looping through m_pCompData
Bo Xu [Wed, 27 Aug 2014 20:13:42 +0000]
Fix a bug when looping through m_pCompData

BUG=408154
R=tsepez@chromium.org

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

4 years agoBounds check before fixed-size memcmp() in CJPX_Decoder::Init().
Tom Sepez [Tue, 26 Aug 2014 23:35:12 +0000]
Bounds check before fixed-size memcmp() in CJPX_Decoder::Init().

BUG=407476
R=jun_fang@foxitsoftware.com

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

4 years agoFix compile on mac: format string mismatch error.
Tom Sepez [Tue, 26 Aug 2014 21:03:25 +0000]
Fix compile on mac: format string mismatch error.

See http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg/builds/9542/steps/compile%20%28with%20patch%29/logs/stdio

TBR=jun_fang@foxitsoftware.com,

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

4 years agoSet m_pLinearized to NULL after release
Bo Xu [Mon, 25 Aug 2014 22:22:07 +0000]
Set m_pLinearized to NULL after release

BUG=406868
R=tsepez@chromium.org

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

4 years agoPerform better input checks in early steps of parser.
Tom Sepez [Mon, 25 Aug 2014 21:59:02 +0000]
Perform better input checks in early steps of parser.

BUG=406591
R=jun_fang@foxitsoftware.com

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

4 years agoUse number of components from ICC profile and alternate color space
Bo Xu [Mon, 25 Aug 2014 20:45:17 +0000]
Use number of components from ICC profile and alternate color space

BUG=406806
R=tsepez@chromium.org

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

4 years agoAdd GetValidBpc() check in CPDF_DIBSource::CreateDecoder()
Bo Xu [Mon, 25 Aug 2014 20:34:01 +0000]
Add GetValidBpc() check in CPDF_DIBSource::CreateDecoder()

BUG=406908
R=tsepez@chromium.org

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

4 years agoAdd GetValidBpc() check in CPDF_DIBSource::GetScanLine
Bo Xu [Mon, 25 Aug 2014 20:31:16 +0000]
Add GetValidBpc() check in CPDF_DIBSource::GetScanLine

BUG=406600, 406895
R=tsepez@chromium.org

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

4 years agoRevert of Use number of components from ICC profile and alternateCS (patchset #1...
Bo Xu [Mon, 25 Aug 2014 18:52:41 +0000]
Revert of Use number of components from ICC profile and alternateCS (patchset #1 of https://codereview.chromium.org/493163003/)

Reason for revert:
Needs to address comments before landing

Original issue's description:
> Use number of components from ICC profile and alternate color space
>
> BUG=406806
>
> Committed: https://pdfium.googlesource.com/pdfium/+/be83103

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

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

4 years agoUse number of components from ICC profile and alternate color space
Bo Xu [Mon, 25 Aug 2014 17:01:19 +0000]
Use number of components from ICC profile and alternate color space

BUG=406806

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

4 years agoFix the issue 'SEGV on unknown address in CPDF_DataAvail::GetObjectSize'
Jun Fang [Sat, 23 Aug 2014 00:06:32 +0000]
Fix the issue 'SEGV on unknown address in CPDF_DataAvail::GetObjectSize'

BUG=387983
R=tsepez@chromium.org

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

4 years agoFix a hang issue due to inconsistent page number in the test file
Jun Fang [Sat, 23 Aug 2014 00:04:29 +0000]
Fix a hang issue due to inconsistent page number in the test file

Pdfium reads the page number from the field of '/Count' but it can't
load the number assigned by this field due to the damaged data. Add a
check to ensure that the required page should be one of loaded pages.

BUG=406090
R=tsepez@chromium.org

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

4 years agoBounds check in CFX_Font::LoadGlyphPath().
Tom Sepez [Fri, 22 Aug 2014 23:07:58 +0000]
Bounds check in CFX_Font::LoadGlyphPath().

Add a check to CFX_Font::LoadGlyphPath() similar to the one that exists
in CFX_FaceCache::RenderGlyph().

Also replace some scattered magic numbers in the file with constants,
and make arrays not used outside this file be statically scoped.

BUG=406144
R=jun_fang@foxitsoftware.com

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

4 years agoFix confusion between length in bytes and length in characters in app::response().
Tom Sepez [Fri, 22 Aug 2014 22:52:05 +0000]
Fix confusion between length in bytes and length in characters in app::response().

I also clean up the code while we are here, rewriting a strange switch statement and tidying whitespace.

BUG=406142
R=jun_fang@foxitsoftware.com

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

4 years agoDon't stretch bitmaps if destination size is empty.
Vitaly Buka [Fri, 22 Aug 2014 21:01:56 +0000]
Don't stretch bitmaps if destination size is empty.

BUG=405201
R=bo_xu@foxitsoftware.com

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

4 years agoCheck the number of component in ICCBased colorspace
Bo Xu [Fri, 22 Aug 2014 17:30:10 +0000]
Check the number of component in ICCBased colorspace

From PDF reference 8.6.5.5, this could only be 1, 3 or 4.

BUG=387968
R=tsepez@chromium.org

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

5 years agoFor pattern colorspace, its base colorspace should not be a pattern colorspace
Bo Xu [Thu, 21 Aug 2014 22:19:00 +0000]
For pattern colorspace, its base colorspace should not be a pattern colorspace

BUG=405588
R=tsepez@chromium.org

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

5 years agoCheck if user provided more than one option for pdfium_test.
Vitaly Buka [Wed, 20 Aug 2014 17:32:36 +0000]
Check if user provided more than one option for pdfium_test.

R=bo_xu@foxitsoftware.com

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

5 years agoFix bug in CPDF_PageContentGenerate constructor and destructor
Bo Xu [Wed, 20 Aug 2014 00:17:04 +0000]
Fix bug in CPDF_PageContentGenerate constructor and destructor

m_pageObjects never gets initialize, thus making CPDF_PageContentGenerate::GenerateContent() doing nothing.

Since the CPFD_PageObject are owned by m_pPage, no need to release them in the destructor.

BUG=385119
R=thestig@chromium.org, vitalybuka@chromium.org

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

5 years agoFixed command line parting when no output is needed.
Vitaly Buka [Tue, 19 Aug 2014 21:22:19 +0000]
Fixed command line parting when no output is needed.

R=bo_xu@foxitsoftware.com

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

5 years agoFont is used after release in CPDF_TextStateData::~CPDF_TextStateData
Jun Fang [Mon, 18 Aug 2014 23:39:43 +0000]
Font is used after release in CPDF_TextStateData::~CPDF_TextStateData

BUG=400996
R=tsepez@chromium.org

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

5 years agoFix a double-free issue in CFX_PathData::~CFX_PathData
Jun Fang [Mon, 18 Aug 2014 19:21:44 +0000]
Fix a double-free issue in CFX_PathData::~CFX_PathData

In CPDFSDK_InterForm::SubmitFields, the buffer pointed by m_pBuffer is returned
and released by the caller. However, it will be released again in the destructor.

BUG=401580
R=tsepez@chromium.org

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

5 years agoCheck path point count overflow in DrawThisAppearance
Bo Xu [Mon, 18 Aug 2014 18:33:03 +0000]
Check path point count overflow in DrawThisAppearance

BUG=387969
R=tsepez@chromium.org

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

5 years agoAdd a null check before getting unicode text in CPDF_FormField::GetValue
Jun Fang [Mon, 18 Aug 2014 18:30:19 +0000]
Add a null check before getting unicode text in CPDF_FormField::GetValue

The test pdf file defines an invalid dictionary object with a NULL arrary
in the filed of "/V". It causes that a NULL object is returned when trying
to get the first element of this arrary. So it needs to check whether the
returned object is NULL.

BUG=395986
R=tsepez@chromium.org

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

5 years agoAdd a null pointer check before getting the family name of the given color space...
Jun Fang [Mon, 18 Aug 2014 18:27:20 +0000]
Add a null pointer check before getting the family name of the given color space in CPDF_ColorSpace::Load

The test file defines a wrong color space object (7 0 obj). In the content of 7 0 obj,
the reserved obj (0 0 R) is used. The process of loading color space returns NULL when
the reserved obj (0 0 R) is found. For the error color space, it only needs to return
NULL when an error is detected.

BUG=403032
R=tsepez@chromium.org

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

5 years agoFix tzHour usage on systems where char is unsigned.
Nico Weber [Mon, 18 Aug 2014 18:17:42 +0000]
Fix tzHour usage on systems where char is unsigned.

BUG=chromium:395832
R=bo_xu@foxitsoftware.com

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

5 years agoNo need to release m_pBaseCS in CPDF_IndexedCS and CPDF_PatternCS
Bo Xu [Mon, 18 Aug 2014 16:58:58 +0000]
No need to release m_pBaseCS in CPDF_IndexedCS and CPDF_PatternCS

m_pBaseCS will be released in CPDF_DocPageData::Clear.

BUG=401372
R=tsepez@chromium.org

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

5 years agoFix buffer size offset error in PNG_Predictor
Bo Xu [Fri, 15 Aug 2014 19:24:45 +0000]
Fix buffer size offset error in PNG_Predictor

BUG=393602
R=tsepez@chromium.org

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

5 years agoAdd FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.
Tom Sepez [Thu, 14 Aug 2014 00:12:28 +0000]
Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.

Should there be cases where this fails to compile, it indicates a mistake,
either an incorrectly declared overrriden virtual method, or a method that
should be declared non-virtual.

The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(),
and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere,
and are removed.  Two members are removed that are no longer needed once those
methods are removed.

R=jam@chromium.org, jun_fang@foxitsoftware.com

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

5 years agoDisable exceptions for the pdfium targets, now that pdfium:29 is done.
Nico Weber [Wed, 13 Aug 2014 18:12:31 +0000]
Disable exceptions for the pdfium targets, now that pdfium:29 is done.

BUG=pdfium:29
R=scottmg@chromium.org

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

5 years agoRemove try/catch block
Bo Xu [Wed, 13 Aug 2014 18:03:19 +0000]
Remove try/catch block

BUG=pdfium:28
R=thakis@chromium.org

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

5 years agoTreat null Parent as no Parent for dictionary objects
Bo Xu [Tue, 12 Aug 2014 18:10:51 +0000]
Treat null Parent as no Parent for dictionary objects

To be complient with PDF reference chapter 7.3.7

BUG=402437
R=vitalybuka@chromium.org

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

5 years agoFix missing or broken include guard macros in pdfium headers.
Tom Sepez [Tue, 12 Aug 2014 21:43:18 +0000]
Fix missing or broken include guard macros in pdfium headers.

This has no ill-effect at present, but may be distracting when viewing the file
since it just looks wrong.

R=jun_fang@foxitsoftware.com

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

5 years agoFor a CPDF_Color object, when set a new pattern to it, disconnect its link with the...
Bo Xu [Tue, 12 Aug 2014 21:36:21 +0000]
For a CPDF_Color object, when set a new pattern to it, disconnect its link with the old pattern

This patch is related to https://pdfium.googlesource.com/pdfium/+/1b9c5c4dc41956b8c5ab17b9a882adf8a2513768

BUG=402260
R=tsepez@chromium.org

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

5 years agoWhen normalize coordinate, return instead of assert() when divide by 0
Bo Xu [Fri, 8 Aug 2014 02:01:34 +0000]
When normalize coordinate, return instead of assert() when divide by 0

BUG=382988
R=tsepez@chromium.org

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

5 years agoChange '>=' back to '>' in extension.h due to bad fix
Jun Fang [Thu, 7 Aug 2014 17:08:19 +0000]
Change '>=' back to '>' in extension.h due to bad fix

BUG=400662
R=tsepez@chromium.org

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

5 years agogclient DEPS file for auto checking out deps
Aneesh Mulye [Thu, 7 Aug 2014 01:11:02 +0000]
gclient DEPS file for auto checking out deps

Added a DEPS file so that bot_update and gclient can automatically check
out dependencies (GYP, V8, ICU, and on Windows, Cygwin).

BUG=375773
R=jam@chromium.org, nodir@chromium.org

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

5 years agoClean up meaningless branch on commented-out code.
Chris Palmer [Wed, 6 Aug 2014 21:17:45 +0000]
Clean up meaningless branch on commented-out code.

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

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

5 years agoFix the problem that memory is accessed after released due to invalid type-cast
Jun Fang [Tue, 5 Aug 2014 11:32:48 +0000]
Fix the problem that memory is accessed after released due to invalid type-cast

BUG=387774
R=palmer@chromium.org, tsepez@chromium.org

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

5 years agoThe root cause of this issue is shown as below:
Jun Fang [Tue, 5 Aug 2014 09:38:22 +0000]
The root cause of this issue is shown as below:
Patterns are managed in CPDF_DocPageData. When
a document is closed, all patterns will be
released in the deconstruction of CPDF_DocPageData.
However, some patterns which are referenced in
CPDF_Color can't get the notification from the
destroy of CPDF_DocPageData. It will cause
use-after-free in CPDF_Color::~CPDF_Color.

BUG=392719
R=tsepez@chromium.org

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

5 years agoFix unninitialized 'tmp' in CJBig2_Image::composeTo_opt2
Jun Fang [Tue, 5 Aug 2014 02:25:14 +0000]
Fix unninitialized 'tmp' in CJBig2_Image::composeTo_opt2

BUG=387811
R=tsepez@chromium.org

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

5 years agoRemove unused |m_pEvi| field.
Chris Palmer [Mon, 4 Aug 2014 22:58:07 +0000]
Remove unused |m_pEvi| field.

Edge closer to the goal of building PDFium with the chromium_code
configuration.

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

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

5 years agoFix a segmentation fault in CPDF_DataAvail::CheckPage due to invalid usage of i++
Jun Fang [Mon, 4 Aug 2014 19:58:19 +0000]
Fix a segmentation fault in CPDF_DataAvail::CheckPage due to invalid usage of i++

BUG=387979
R=tsepez@chromium.org

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

5 years agoFix buffer size boundary check offset by 1
Bo Xu [Sat, 2 Aug 2014 22:13:46 +0000]
Fix buffer size boundary check offset by 1

When newPos == file size, the current block will not be read or Get. If this block is a crucial part of the document (like m_pTrailer), the program will exit with parse error and
the document will not be rendered.

BUG=None
R=jun_fang@foxitsoftware.com

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

5 years agoAdd more |bpc| value check in GetValidBpc()
Bo Xu [Fri, 1 Aug 2014 23:14:27 +0000]
Add more |bpc| value check in GetValidBpc()

BUG=382988
R=tsepez@chromium.org

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

5 years agoFix for min/max compile error on Windows
Scott Graham [Fri, 1 Aug 2014 05:12:25 +0000]
Fix for min/max compile error on Windows

Patch from jschuh@chromium.org.

BUG=pdfium:31
TBR=jschuh@chromium.org,thakis@chromium.org

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

5 years agoRevert 'gn: cross-platform exception disable'
Scott Graham [Fri, 1 Aug 2014 00:23:24 +0000]
Revert 'gn: cross-platform exception disable'

This reverts commit 4923e3cfbc2b617614858c427fa87a8c67aca784.

Since exceptions are in the process of being removed,
and the code currently isn't rollable into pdfium (for other
reasons) I'm going to revert this for now, so that this CL
doesn't become blocking-for-rolls if the other min/max problem
is addressed.

And, hopefully by the time I get back to this it won't be
necessary anyway.

BUG=pdfium:28,pdfium:31,chromium:354261
R=thakis@chromium.org

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

5 years agogn: cross-platform exception disable
Scott Graham [Thu, 31 Jul 2014 22:17:36 +0000]
gn: cross-platform exception disable

Goes with https://codereview.chromium.org/431803003/

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

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

5 years agoremove .gitattributes to prevent automatic CRLF conversions
Scott Graham [Thu, 31 Jul 2014 22:16:30 +0000]
remove .gitattributes to prevent automatic CRLF conversions

Added by https://codereview.chromium.org/292313014/ but causes
annoying warnings on Windows. Just don't add CRLFs.

R=jam@chromium.org

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

5 years agoCorrect the names of the FX_SAFE_* typedefs.
Chris Palmer [Thu, 31 Jul 2014 19:08:56 +0000]
Correct the names of the FX_SAFE_* typedefs.

R=jun_fang@foxitsoftware.com

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

5 years agoFix a few more -Wreorder warnings.
Nico Weber [Thu, 31 Jul 2014 17:07:04 +0000]
Fix a few more -Wreorder warnings.

No intended behavior change.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoRemove CPDFSDK_Annot::ResetAppearance().
Nico Weber [Thu, 31 Jul 2014 17:00:12 +0000]
Remove CPDFSDK_Annot::ResetAppearance().

It's unused, and it caused a warning about CPDFSDK_Widget::ResetAppearance()
failing to override it (since these two unrelated methods had the same name).

No intended behavior change.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoFix integer overflow when stretch bitmap
Bo Xu [Thu, 31 Jul 2014 16:55:36 +0000]
Fix integer overflow when stretch bitmap

When an image object is zoomed in by a big factor, the scaling factor in the transformation matrix is big as well, resulting in a large |dest_width| and |dest_height| value(they can be think of as the equivalent pixel size of the entire image, although most of it is outside the device).

BUG=395636
R=vitalybuka@chromium.org

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

5 years agoFix uninitialized coords and one of infinite loops
JUN FANG [Thu, 31 Jul 2014 06:12:56 +0000]
Fix uninitialized coords and one of infinite loops

BUG=387854
R=tsepez@chromium.org

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

5 years agoRemove a few unused variables, functions, and member variables.
Nico Weber [Thu, 31 Jul 2014 02:00:31 +0000]
Remove a few unused variables, functions, and member variables.

No intended behavior change.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoFix a few -Wreorder warnings.
Nico Weber [Thu, 31 Jul 2014 01:59:57 +0000]
Fix a few -Wreorder warnings.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoAdd missing braces for aggregate initializers.
Nico Weber [Thu, 31 Jul 2014 01:59:36 +0000]
Add missing braces for aggregate initializers.

No intended behavior change.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoFix potential integer overflow in fpdf_render_loadimage.cpp
JUN FANG [Wed, 30 Jul 2014 22:45:33 +0000]
Fix potential integer overflow in fpdf_render_loadimage.cpp

BUG=391929
R=tsepez@chromium.org

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

5 years agoAttempt to fix some -Woverloaded-virtual warnings.
Nico Weber [Wed, 30 Jul 2014 21:17:19 +0000]
Attempt to fix some -Woverloaded-virtual warnings.

There are many warnings that look like:

error: 'CPWL_RadioButton::OnChar' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
        virtual FX_BOOL                         OnChar(FX_WORD nChar);
                                                ^
note: hidden overloaded virtual function 'CPWL_Wnd::OnChar' declared here: different number of parameters (2 vs 1)
        virtual FX_BOOL                                 OnChar(FX_WORD nChar, FX_DWORD nFlag);
                                                        ^

It looks like someone added the nFlag parameter to the methods in CPWL_Wnd
at some point and missed to update all overloads This patch attempts to fix this:
It adds the parameter to all methods that look like they're trying to overload the base
class method, and renames the method in one case where it fairly clearly looks like
that it's not supposed to be an overload.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoFix incorrect override of GetLayoutOrder().
Nico Weber [Wed, 30 Jul 2014 21:16:25 +0000]
Fix incorrect override of GetLayoutOrder().

fsdk_baseform.h:63:19: error: 'CPDFSDK_Widget::GetLayoutOrder' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
        virtual int                                             GetLayoutOrder() {return 2;}
                                                                ^
fsdk_baseannot.h:70:18: note: hidden overloaded virtual function 'CPDFSDK_Annot::GetLayoutOrder' declared here: different qualifiers (const vs none)
        virtual int                                     GetLayoutOrder() const { return 5; }
                                                        ^

On Windows, I believe MSVS treats these as override since it's such a common and
easy mistake, but clang and gcc do what the standard specifies. Add a "const" to
the function in the subclass so that this is actually an override, as intended.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoFix the potential integer overflow from 'offset+size' in extension.h and fpdfview.cpp
JUN FANG [Wed, 30 Jul 2014 20:46:39 +0000]
Fix the potential integer overflow from 'offset+size' in extension.h and fpdfview.cpp

BUG=397258
R=tsepez@chromium.org

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

5 years agoSpeculative fix for uninitialized value in CFX_ByteString().
Tom Sepez [Wed, 30 Jul 2014 20:03:52 +0000]
Speculative fix for uninitialized value in CFX_ByteString().

If somehow different length values could be obtained by two successive calls
to Doc_getFilePath() (and FieldBrowse() for that matter), and the method is
true to the API documentation that says "The return value always indicated
number of bytes required for the buffer, even when there is no buffer
specified, or the buffer size is less then required", then it is possible
to get a returned length describing memory beyond the current buffer.

We can make the corresponding JS_docGetFilePath() method more robust against
this case by applying better checks to the returned value.

This probably is unrelated since ASAN seems to be flagging the corresponding bug
as UAF, but doesn't hurt to make things more robust.

BUG=392956
R=jun_fang@foxitsoftware.com

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

5 years agoFix the typo of "Resources" keyword
Bo Xu [Tue, 29 Jul 2014 13:38:16 +0000]
Fix the typo of "Resources" keyword

BUG=None
R=thestig@chromium.org

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

5 years agoTidy up app::response().
Tom Sepez [Tue, 29 Jul 2014 21:01:21 +0000]
Tidy up app::response().

Follow-up from https://codereview.chromium.org/424883002/

- Remove some stray whitespace.
- Fix "else after return".
- Remove unused swResponse local.
- Treat unexpectedly large responses as errors.

BUG=
R=jun_fang@foxitsoftware.com

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

5 years agoFix a few more warnings in chromium_code mode.
Nico Weber [Tue, 29 Jul 2014 17:13:17 +0000]
Fix a few more warnings in chromium_code mode.

No intended behavior change.

- Remove more unused variables, functions, member variables.
- Put a few constructor initializers in the order they execute in.
- Add braces for subobject initializers.
- Fix a handful of signed / unsigned comparisons.

BUG=pdfium:29
R=bo_xu@foxitsoftware.com

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

5 years agoRemove a few unused variables, functions, and tables.
Nico Weber [Tue, 29 Jul 2014 15:55:54 +0000]
Remove a few unused variables, functions, and tables.

Found by clang's -Wunused-variable, -Wunused-function, -Wunused-const-variable.

BUG=none
R=bo_xu@foxitsoftware.com

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

5 years agoRemove 'inline' from two methods.
Nico Weber [Mon, 28 Jul 2014 22:23:04 +0000]
Remove 'inline' from two methods.

The methods are only defined in the cpp and thus can't always be inlined,
the methods are virtual and so can only be inlined when the concrete type
is known, and inline functions need their definition available in all
translation units.

So just remove the 'inline'.

BUG=none
R=bo_xu@foxitsoftware.com

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

5 years agoCalRGB color correction
Bo Xu [Fri, 25 Jul 2014 00:50:59 +0000]
CalRGB color correction

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

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

5 years agoThis change is for fixing the potential integer overflow from "offset + size"
JUN FANG [Thu, 24 Jul 2014 19:19:57 +0000]
This change is for fixing the potential integer overflow from "offset + size"

BUG=382667
R=palmer@chromium.org

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

5 years agoRefactor CFX_BasicArray.
Chris Palmer [Wed, 23 Jul 2014 22:00:32 +0000]
Refactor CFX_BasicArray.

The |nGrowBy| argument to |SetSize| was always -1, which caused the
effective m_nGrowBy value to always be its default value: 0. So it was not
needed, and was cluttering up the logic.

BUG=384662

Check for integer overflow in CFX_BasicArray.

BUG=384662
R=bo_xu@foxitsoftware.com, rsesek@chromium.org

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

5 years agoCheck for integer overflow in CFX_BasicArray.
Chris Palmer [Wed, 23 Jul 2014 21:56:29 +0000]
Check for integer overflow in CFX_BasicArray.

BUG=384662
R=bo_xu@foxitsoftware.com, rsesek@chromium.org

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

5 years agoRemove unnecessary aligned memory check when __SSE__ is used
Bo Xu [Wed, 23 Jul 2014 20:05:23 +0000]
Remove unnecessary aligned memory check when __SSE__ is used

Since the land of https://pdfium.googlesource.com/pdfium/+/3522876d5291922ddc62bf1b70d02743b0850673, memory is assured to be 16 byte aligned. So no need to do this check.

Plus, the removed code was causing bug in M36: https://code.google.com/p/pdfium/issues/detail?id=27.

BUG=None
R=thestig@chromium.org

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

5 years agoOnly use "final" on MSVS2012+, to keep pdfium building with 2010.
Nico Weber [Wed, 23 Jul 2014 17:54:59 +0000]
Only use "final" on MSVS2012+, to keep pdfium building with 2010.

BUG=pdfium:26
TBR=bo_xu@foxitsoftware.com

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

5 years agoFix potential memory violation in CJS_PublicMethods::StrRTrim()
Tom Sepez [Wed, 23 Jul 2014 17:50:06 +0000]
Fix potential memory violation in CJS_PublicMethods::StrRTrim()

BUG=395266
R=jun_fang@foxitsoftware.com

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

5 years agoFix lookahead beyond bounds in CJS_PublicMethods::MakeFormatDate().
Tom Sepez [Wed, 23 Jul 2014 17:28:37 +0000]
Fix lookahead beyond bounds in CJS_PublicMethods::MakeFormatDate().

BUG=396255
R=jun_fang@foxitsoftware.com

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

5 years agoFix FPDF_RenderPage 2x zoom in when bBackgroundAlphaNeeded is true
Bo Xu [Wed, 23 Jul 2014 17:09:08 +0000]
Fix FPDF_RenderPage 2x zoom in when bBackgroundAlphaNeeded is true

BUG=179413
R=thestig@chromium.org

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

5 years agoAdded options to save pages into BMP and EMF on Windows.
Vitaly Buka [Wed, 23 Jul 2014 01:15:42 +0000]
Added options to save pages into BMP and EMF on Windows.

BUG=179413
R=bo_xu@foxitsoftware.com

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

5 years agoAdjust null object check
Bo Xu [Mon, 21 Jul 2014 17:02:07 +0000]
Adjust null object check

BUG=None
R=thakis@chromium.org

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

5 years agoFix remaining -Wdelete-non-virtual-dtor violations on Windows.
Nico Weber [Mon, 21 Jul 2014 16:50:56 +0000]
Fix remaining -Wdelete-non-virtual-dtor violations on Windows.

Follow-up to https://codereview.chromium.org/370853002/

BUG=none
R=bo_xu@foxitsoftware.com

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

5 years agoBuild with exceptions enabled on Windows too.
Nico Weber [Fri, 18 Jul 2014 22:50:30 +0000]
Build with exceptions enabled on Windows too.

This should be set consistently on all platforms. Ideally, we wouldn't
need exceptions, but for now they're used.

BUG=none (noticed while looking at chromium:82385)
R=jam@chromium.org

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

5 years agoFix the potential integer overflow from "offset + size".
Chris Palmer [Fri, 18 Jul 2014 22:18:43 +0000]
Fix the potential integer overflow from "offset + size".

BUG=382667
R=jschuh@chromium.org, jun_fang@foxitsoftware.com

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

5 years agoFix bounds checking in CJS_PublicMethods::MakeRegularDate().
Tom Sepez [Fri, 18 Jul 2014 21:42:12 +0000]
Fix bounds checking in CJS_PublicMethods::MakeRegularDate().

The function is looking ahead N characters at both its "format" and "value"
strings without validating that accesses are in bounds.  Add those validations.

There are also duplicate checks in the else-branches which re-test the inverse
of the if-branch.  These are removed for simplicity.

I also tidied some stray whitespace in the function while I was at it.

BUG=393831
R=jun_fang@foxitsoftware.com

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

5 years agoFix pdfium building issue on VS2010
Jun Fang [Fri, 18 Jul 2014 16:36:53 +0000]
Fix pdfium building issue on VS2010

BUG=pdfium_23
R=palmer@chromium.org

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

5 years agopdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.
Nico Weber [Fri, 18 Jul 2014 16:14:35 +0000]
pdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.

Calling `delete` on an object of a type that has virtual functions but
not a virtual destructor is questionable: Since the object has virtual functions,
it likely has subclasses, so if it's deleted through the base pointer and the
destructor isn't virtual, the subclass destructor won't be called.

In most cases, the classes getting deleted can just be marked final to tell
the compiler that it can't possibly have subclasses (this also enables the
compiler to generate better code).

Two classes didn't have any sub- or superclasses but virtual functions -
this doesn't make sense, so make all methods of these classes non-virtual.
(Also delete an unused function on one of the two classes.)

In one case, a class actually did have a subclass that needs to be deleted
virtually, so mark one destructor as virtual.

BUG=none
R=bo_xu@foxitsoftware.com

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

5 years agoFix garbled text when loading linearized pdf document
Bo Xu [Thu, 17 Jul 2014 18:13:13 +0000]
Fix garbled text when loading linearized pdf document

BUG=260112, 249006, 275281, 354966, 365302, 236952
R=thestig@chromium.org

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

5 years agoFix building pdfium for x64 with ninja under windows.
Nico Weber [Thu, 17 Jul 2014 16:02:20 +0000]
Fix building pdfium for x64 with ninja under windows.

This adds the necessary directives to the standalone gyp file.

R=jschuh@chromium.org, jam@chromium.org
BUG=22

Patch from Michael Doppler <m.doppler@gmail.com>.

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

5 years agoHook up the default v8::Platform implementation to pdfium
Jochen Eisinger [Thu, 17 Jul 2014 06:46:45 +0000]
Hook up the default v8::Platform implementation to pdfium

It remains to call the PumpMessageLoop() method at a regular interval,
however, since nothing posts to the loop yet, that shouldn't be a
problem.

BUG=25
R=jam@chromium.org

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

5 years agoDisable warning 4267 in pdfium until it is fixed.
Nico Weber [Thu, 17 Jul 2014 00:31:56 +0000]
Disable warning 4267 in pdfium until it is fixed.

BUG=376399
TBR=thestig@chromium.org

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

5 years agoRemove unused variable orig_size.
Bo Xu [Wed, 16 Jul 2014 23:31:29 +0000]
Remove unused variable orig_size.

Original patch by Andrey Khalyavin <halyavin@google.com>

BUG=N/A
R=bo_xu@foxitsoftware.com

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

5 years agoDo not disable warnings-as-errors for pdfium.
Nico Weber [Wed, 16 Jul 2014 20:44:28 +0000]
Do not disable warnings-as-errors for pdfium.

It currently doesn't have any build warnings, and this way the
chromium build is guaranteed to stay warning-free after pdfium rolls.

BUG=none
R=jam@chromium.org

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

5 years agoAdd a newline at the end of fpdfeditpage.cpp.
Nico Weber [Wed, 16 Jul 2014 20:19:08 +0000]
Add a newline at the end of fpdfeditpage.cpp.

Fixes a warning.

BUG=
TBR=bo_xu@foxitsoftware.com

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

5 years agoRemove uninitialized const global g_GbFontNameMap.
Nico Weber [Wed, 16 Jul 2014 18:07:33 +0000]
Remove uninitialized const global g_GbFontNameMap.

C++11 makes uninitialized const PODs an error, because they contain
uninitialized memory (they're uninitialized that can never be initialized
(because they're const).

In this case, the memory was only used by _GetSubFontName() if the lang
parameter was 1, but _GetSubFontName() is only called from one place, with
a lang parameter of 0. So remove _GetSubFontName()'s lang parameter too.

(Using bsearch for searching an array that always has exactly 2 entries is
overkill too, but I'm trying to keep the diff small.)

No intended behavior change. Fixes this error on the clang/win bot:
..\..\third_party\pdfium\core\src\fxge\win32\fx_win32_device.cpp(207,20) :  error(clang): default initialization of an object of const type 'const _FontNameMap [1]'
const _FontNameMap g_GbFontNameMap[1];
                   ^

BUG=chromium:82385
R=bo_xu@foxitsoftware.com

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

5 years agoError handling for invalid component number in CPDF_ICCBasedCS::v_Load
Jun Fang [Wed, 16 Jul 2014 03:42:53 +0000]
Error handling for invalid component number in CPDF_ICCBasedCS::v_Load

BUG=386728
R=palmer@chromium.org

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

5 years agoFix uninitialized coords in _DrawCoonPatchMeshes
Jun Fang [Tue, 15 Jul 2014 03:57:18 +0000]
Fix uninitialized coords in _DrawCoonPatchMeshes

BUG=391470
R=palmer@chromium.org

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

5 years agoFix uninitialized nresults in GetRGB
Jun Fang [Tue, 15 Jul 2014 00:07:23 +0000]
Fix uninitialized nresults in GetRGB

BUG=387809
R=palmer@chromium.org

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

5 years agoFix uninitialized RGB in DrawShading
Jun Fang [Mon, 14 Jul 2014 23:31:37 +0000]
Fix uninitialized RGB in DrawShading

BUG=386730
R=palmer@chromium.org

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

5 years agoFix uninitialized Storage in _LUTeval16
foxit [Mon, 14 Jul 2014 21:46:37 +0000]
Fix uninitialized Storage in _LUTeval16

BUG=387826
R=palmer@chromium.org

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

5 years agoAdd support to extract viewer preference
Bo Xu [Mon, 14 Jul 2014 20:22:47 +0000]
Add support to extract viewer preference

This change adds the support to extract "NumCopies", "PrintPageRange", "Duplex" viewer preferences for printing.

BUG=169120
R=bo_xu@foxitsoftware.com, vitalybuka@chromium.org

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