New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 718494 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 2
Type: Bug

Blocking:
issue 584819



Sign in to add a comment

Out-of-memory in pdf_codec_tiff_fuzzer

Project Member Reported by ClusterFuzz, May 4 2017

Issue description

Detailed report: https://clusterfuzz.com/testcase?key=4883692150587392

Fuzzer: libfuzzer_pdf_codec_tiff_fuzzer
Job Type: libfuzzer_chrome_asan
Platform Id: linux

Crash Type: Out-of-memory (exceeds 2048 MB)
Crash Address: 
Crash State:
  pdf_codec_tiff_fuzzer
  
Sanitizer: address (ASAN)

Regressed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_asan&range=468576:468586

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=4883692150587392


Issue filed automatically.

See https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/reproducing.md for more information.
 
Project Member

Comment 1 by ClusterFuzz, May 4 2017

Labels: OS-Mac
Cc: msrchandra@chromium.org
Labels: M-60 Test-Predator-Wrong
Owner: npm@chromium.org
Status: Assigned (was: Untriaged)
Assigning to the concern owner as per the Code Search, "pdf_codec_tiff_fuzzer" who worked on similar issue.
@npm -- Could you please look into the issue, kindly re-assign if this is not related to your changes.
Thank You.
Components: Internals>Plugins>PDF

Comment 4 by npm@chromium.org, Jun 14 2017

Labels: -Pri-1 Pri-2

Comment 5 by npm@chromium.org, Jun 26 2017

Owner: ----
Status: Available (was: Assigned)
Filed http://bugzilla.maptools.org/show_bug.cgi?id=2708, should probably wait for it to be fixed upstream.
Labels: -M-60
Status: ExternalDependency (was: Available)
Owner: npm@chromium.org
Status: Assigned (was: ExternalDependency)

Comment 9 by npm@chromium.org, Jul 12 2017

Status: ExternalDependency (was: Assigned)
Not fixed after applying upstream patches, will update bug upstream.
Blocking: 584819
Labels: -Pri-2 Pri-1
The OOM crash happens in 80% of fuzzer runs: https://clusterfuzz.com/v2/performance-report/libFuzzer_pdf_codec_tiff_fuzzer/libfuzzer_chrome_asan/latest

so let me make it Pri-1, since it's a blocker for gaining new coverage and efficient continuous testing

Comment 12 by npm@chromium.org, Jul 27 2017

Cc: mmoroz@chromium.org
I've shared the testcase upstream because they have submitted patches to attempt to fix this but those patches haven't worked so far. LibTIFF is an old library, so it's full of places where mallocs are made without checking that the testcase will actually need all that space (and sometimes it may be nontrivial to do those checks). Fixing this testcase will probably not change the OOM percentage significantly (which by the way is really strange, considering about 80% are OOM and about 55% are crashes - I have no idea how that can possibly occur).

I think what would really be useful here is to allow de-duplicating OOM testcases when the OOM is caused by a sufficiently large malloc, for instance when the error is sent from Fuzzer::HandleMalloc (this testcase is one such example). In these cases, we have the stacktrace of the code where such malloc was requested, so it should work like it does for overflows and other types of bugs.

But anyways, I don't know if LibTIFF will ever be at a state where OOM testcases are not easy to create.
Labels: -Pri-1 Pri-2
Nicolás, thanks for the detailed response! You're right about percentage of OOMs. I took another look at the logs and realized that there are lines like:

==17156:17156==WARNING: AddressSanitizer failed to allocate 0x115000000010000 bytes
==17156:17156==WARNING: AddressSanitizer failed to allocate 0x1000000010400 bytes
==17156:17156==WARNING: AddressSanitizer failed to allocate 0x1000301160000 bytes
==17156:17156==WARNING: AddressSanitizer failed to allocate 0x43ffffffbc2 bytes

which are warnings, not OOM crashes. Thanks for noticing that, I'll upload a fix for our stats calculation.


Regarding 55% of crashes, it's mostly  issue 743621  I think.

Resetting priority back to 2.
Project Member

Comment 14 by bugdroid1@chromium.org, Jul 27 2017

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/d4362fe972442cfd2d6aa9b32134240c0ddaa6c5

commit d4362fe972442cfd2d6aa9b32134240c0ddaa6c5
Author: Nicolas Pena <npm@chromium.org>
Date: Thu Jul 27 21:18:34 2017

Define SIZEOF_VOIDP and other cleanup in tiffconf

This CL uses sizeof to calculate sizes in tiffconf. It adds SIZEOF_VOIDP
to allow LibTIFF to take codepaths reducing OOMs. Finally, it gets rid
of _FX_WIN32_MOBILE_ since it's never defined.

Bug:  chromium:718494 
Change-Id: I9e6fb2812487ccd7d08e56fd1954c716ddccd07b
Reviewed-on: https://pdfium-review.googlesource.com/9410
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>

[modify] https://crrev.com/d4362fe972442cfd2d6aa9b32134240c0ddaa6c5/third_party/libtiff/tiffconf.h
[modify] https://crrev.com/d4362fe972442cfd2d6aa9b32134240c0ddaa6c5/third_party/libtiff/0000-build-config.patch
[delete] https://crrev.com/33805cc811c722a0c5cd439cff419de252cd39c9/third_party/libtiff/0001-build-config.patch
[modify] https://crrev.com/d4362fe972442cfd2d6aa9b32134240c0ddaa6c5/core/fxcrt/cfx_seekablestreamproxy.cpp
[modify] https://crrev.com/d4362fe972442cfd2d6aa9b32134240c0ddaa6c5/core/fxcrt/cfx_datetime.cpp

Project Member

Comment 15 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c

commit 6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c
Author: Nicolas Pena <npm@chromium.org>
Date: Thu Aug 03 20:44:41 2017

LibTIFF: fix defines in tiffconf

This CL hardcodes the defines  used in tiffconf so that the values can
be used inside of '#if'. The CL that changed them was:
https://pdfium-review.googlesource.com/c/9410

SIZEOF_VOIDP was a new variable in that CL. This CL uses __LP64__ to
detect whether this value should be set to 8 or to 4.

Bug:  chromium:718494 
Change-Id: I628d64cb7e2e94c47b8bcc1856abf5949d6578d4
Reviewed-on: https://pdfium-review.googlesource.com/10090
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>

[modify] https://crrev.com/6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c/third_party/libtiff/tiffconf.h
[add] https://crrev.com/6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c/third_party/libtiff/0027-build-config.patch
[modify] https://crrev.com/6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c/third_party/libtiff/README.pdfium

Project Member

Comment 16 by ClusterFuzz, Aug 4 2017

ClusterFuzz has detected this issue as fixed in range 491858:491939.

Detailed report: https://clusterfuzz.com/testcase?key=4883692150587392

Fuzzer: libFuzzer_pdf_codec_tiff_fuzzer
Job Type: libfuzzer_chrome_asan
Platform Id: linux

Crash Type: Out-of-memory (exceeds 2048 MB)
Crash Address: 
Crash State:
  pdf_codec_tiff_fuzzer
  
Sanitizer: address (ASAN)

Regressed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_asan&range=468576:468586
Fixed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_asan&range=491858:491939

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=4883692150587392


See https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/reproducing.md for more information.

If you suspect that the result above is incorrect, try re-doing that job on the test case report page.
Project Member

Comment 17 by ClusterFuzz, Aug 4 2017

Labels: ClusterFuzz-Verified
Status: Verified (was: ExternalDependency)
ClusterFuzz testcase 4883692150587392 is verified as fixed, so closing issue as verified.

If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.

Sign in to add a comment