New issue
Advanced search Search tips

Issue 638856 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: ----
Type: Bug



Sign in to add a comment

Security: pdfium_test: CPU consumption/hang when parsing crafted PDF

Reported by agostino...@gmail.com, Aug 18 2016

Issue description

Hello,

The attached PDF, which is big ~7,4k, takes here, the 100% of the CPU for 33 minutes. At the end it exit normally without errors.

CPU details:
Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz

VERSION:
Pdfium version at this commit: https://pdfium.googlesource.com/pdfium/+/b4694249b336d1c0bea9222880b49dcf9284791d compiled as recommended here: https://pdfium.googlesource.com/pdfium/

Operating System: [Gentoo, kernel-4.4.8]

REPRODUCTION CASE
pdfium_test $ATTACHED_PDF

 
1.pdf
7.2 KB Download
Project Member

Comment 1 by ClusterFuzz, Aug 18 2016

ClusterFuzz is analyzing your testcase. Developers can follow the progress at https://cluster-fuzz.appspot.com/testcase?key=5719828445003776
Cc: jam@chromium.org
Components: Infra>Client>Pdfium
Labels: -Type-Bug-Security -Restrict-View-SecurityTeam Type-Bug
Confirm that pdfium_test freezes when rendering this file. 

+ jam@, could you help triage this bug since you are one of the owners of third_party/pdfium?

Thanks!

Comment 3 by tsepez@chromium.org, Aug 18 2016

Cc: -jam@chromium.org dsinclair@chromium.org
Dan gets these reports nowadays.
Labels: TE-NeedsTriageHelp
Cc: -dsinclair@chromium.org
Components: -Infra>Client>Pdfium Internals>Plugins>PDF
Owner: dsinclair@chromium.org
Moving to the correct component.
Cc: npm@chromium.org
Status: Available (was: Unconfirmed)
This seems to be spending all of it's time in font rendering.  On Mac, it takes about 1:30 to render the file, of which 99.9% of the tmie is in CGDrawGlyphRun(). This comes through CFX_RenderDevice::DrawNormalText -> CFX_AggDeviceDriver::DrawDeviceText().

On linux I didn't do a full run as it takes a long time, after running for a few minutes I got the following.

The path is a bit different, we go through CFX_RenderDevice::DrawNormalText but then drop into freetype code. Of the freetype code, we spend 97.65% of the time in _ft_lcd_filter_fir (that's self time, so that method is doing a _lot_ of work). 

I wonder, if on Linux, we're getting glyph misses as we go through CFX_FaceCache::LookUpGlyphBitmap and CFX_FaceCache::RenderGlyph all the time. Or, maybe there are just that many glyphs in the file?

Comment 7 by npm@chromium.org, Sep 14 2016

Cc: -npm@chromium.org dsinclair@chromium.org
Owner: npm@chromium.org
Status: Started (was: Available)
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 14 2016

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium.git/+/8b1ed16144925205a34e3796b57db72dd6ee6a89

commit 8b1ed16144925205a34e3796b57db72dd6ee6a89
Author: npm <npm@chromium.org>
Date: Wed Sep 14 16:00:50 2016

Map glyph bitmap in LookUpGlyphBitmap even when unsuccessful

CFX_FaceCache::LookUpGlyphBitMap should remember its unsuccessful glyph
bitmap calculations. This is especially important if there are a lot of
repeated requests for the same glyph with large bitmaps (which means
long calculations in freetype). With this CL, the pdf in the bug below
will be rendered quickly.

BUG= chromium:638856 

Review-Url: https://codereview.chromium.org/2338883004

[modify] https://crrev.com/8b1ed16144925205a34e3796b57db72dd6ee6a89/core/fxge/ge/cfx_facecache.cpp

Comment 9 by npm@chromium.org, Sep 14 2016

Status: Fixed (was: Started)
Project Member

Comment 10 by bugdroid1@chromium.org, Sep 14 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c69798bd660c62a0619f4fab6d25a82df95677b9

commit c69798bd660c62a0619f4fab6d25a82df95677b9
Author: pdfium-deps-roller <pdfium-deps-roller@chromium.org>
Date: Wed Sep 14 17:37:40 2016

Roll src/third_party/pdfium/ 79db60994..8b1ed1614 (1 commit).

https://pdfium.googlesource.com/pdfium.git/+log/79db609948b0..8b1ed1614492

$ git log 79db60994..8b1ed1614 --date=short --no-merges --format='%ad %ae %s'
2016-09-14 npm Map glyph bitmap in LookUpGlyphBitmap even when unsuccessful

BUG= 638856 

TBR=dsinclair@chromium.org

Review-Url: https://codereview.chromium.org/2332333004
Cr-Commit-Position: refs/heads/master@{#418605}

[modify] https://crrev.com/c69798bd660c62a0619f4fab6d25a82df95677b9/DEPS

Sign in to add a comment