odoo/odoo#237396

Created by fw-bot
Merged at 78c384c56bd8a5c59ffb38cb865c12f3d17cbf56

Statuses:

label
odoo-dev:saas-18.4-17.0-opw-5142961-fix-agr-479924-fw
head
b8dd4e560f07a1d27e186747f3f8e0bca54ab5d4
merged
4 months ago by Bugfix, Andrea Grazioso (agr)
odoo/odoo
17.0 #234587
18.0 #237310
saas-18.2 #237341
saas-18.3 #237366
saas-18.4 #237396
19.0 #237422
saas-19.1
saas-19.2
master #237450

[FIX] base: prevent traceback when merging malformed pdfs

Currently some PDFs cause error in PyPDF (Version 1 and 2) and cannot be merged.

Steps to reproduce:

Issue:

Traceback will raise
PyPDF2.errors.PdfReadError: Can't read object stream: Stream has ended unexpectedly
Thsi occurs because the version of PyPDF currently in use (2.12.1) cannot recover when working an odd PDF file having wrong length markers.

This commit will add a nice error explaining to user what's going on.

opw-5142961

Forward-Port-Of: #234587