Commit 4e090cd9 authored by Jérome Perrin's avatar Jérome Perrin

stack/erp5: backport a PyPDF fix

parent 905c1288
From f0913cee83b897a58c150911ab9e8ed8c605c472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 1 Nov 2023 09:44:23 +0100
Subject: [PATCH] fix pdf reader getting stuck when trying to read large files
wihhout xref marker #808
Backport of a PyPDF commit
---
PyPDF2/pdf.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py
index 7bba1c6..0034c90 100644
--- a/PyPDF2/pdf.py
+++ b/PyPDF2/pdf.py
@@ -1919,7 +1919,7 @@ class PdfFileReader(object):
def readNextEndLine(self, stream):
debug = False
if debug: print(">>readNextEndLine")
- line = b_("")
+ line_parts = []
while True:
# Prevent infinite loops in malformed PDFs
if stream.tell() == 0:
@@ -1946,10 +1946,11 @@ class PdfFileReader(object):
break
else:
if debug: print(" x is neither")
- line = x + line
+ line_parts.append(x)
if debug: print((" RNEL line:", line))
if debug: print("leaving RNEL")
- return line
+ line_parts.reverse()
+ return b"".join(line_parts)
def decrypt(self, password):
"""
--
2.39.2
......@@ -690,7 +690,9 @@ Products.CMFCore-patches = ${:_profile_base_location_}/../../component/egg-patch
Products.CMFCore-patch-options = -p1
Products.DCWorkflow-patches = ${:_profile_base_location_}/../../component/egg-patch/Products.DCWorkflow/workflow_method-2.4.1.patch#ec7bb56a9f1d37fcbf960cd1e96e6e6d
Products.DCWorkflow-patch-options = -p1
PyPDF2-patches = ${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0001-Custom-implementation-of-warnings.formatwarning-remo.patch#d25bb0f5dde7f3337a0a50c2f986f5c8
PyPDF2-patches =
${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0001-Custom-implementation-of-warnings.formatwarning-remo.patch#d25bb0f5dde7f3337a0a50c2f986f5c8
${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0002-fix-pdf-reader-getting-stuck-when-trying-to-read-lar.patch#c06a29b6b6a5df612ae36731b938fb95
PyPDF2-patch-options = -p1
python-magic-patches = ${:_profile_base_location_}/../../component/egg-patch/python_magic/magic.patch#de0839bffac17801e39b60873a6c2068
python-magic-patch-options = -p1
......@@ -740,7 +742,7 @@ depends =
Acquisition = 4.7+SlapOSPatched001
Products.DCWorkflow = 2.4.1+SlapOSPatched001
ocropy = 1.0+SlapOSPatched001
PyPDF2 = 1.26.0+SlapOSPatched001
PyPDF2 = 1.26.0+SlapOSPatched002
pysvn = 1.9.15+SlapOSPatched001
python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment