Skip to content

PyPDF2 is using all CPU from one core when reading some PDFs #184

Description

@fgeek

Hi,

I found denial of service issue from PyPDF2 version 1.24. With fuzzed sample file PyPDF2 ends up using all CPU from one core.

Sample file is located at http://bugs.fi/media/afl/pypdf2/pypdf2-1.24-afl-dos.pdf which is fuzzed with American fuzzy lop and using https://bitbucket.org/jwilk/python-afl project as instrumentation component.

References:

crasher.py (SHA1: a4fcecaa1e49472d45d6b2155cf70d62620b9622)

import PyPDF2
import sys
output = PdfFileWriter()
try:
    input1 = PdfFileReader(open(sys.argv[1], "rb"))
except PyPDF2.utils.PdfReadError:
    sys.exit()
print "document has %d pages." % input1.getNumPages()
output.addPage(input1.getPage(0).rotateClockwise(90))
outputStream = file('example2.pdf, "wb")
output.write(outputStream)

Execution with Python 2.7.9 using latest Git version (41d90b4):

python crasher.py pypdf2-1.24-afl-dos.pdf 1-2
PdfReadWarning: Xref table not zero-indexed. ID numbers for objects will not be corrected. [pdf.py:1509]

Metadata

Metadata

Assignees

No one assigned

    Labels

    nf-securityNon-functional change: Security

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions