pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/textproc/py-pdfrw



Module Name:    pkgsrc
Committed By:   joerg
Date:           Thu Sep 28 22:19:37 UTC 2023

Modified Files:
        pkgsrc/textproc/py-pdfrw: Makefile
Added Files:
        pkgsrc/textproc/py-pdfrw/patches: patch-pdfrw_pdfreader.py

Log Message:
Include a fix for certain common broken PDFs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/textproc/py-pdfrw/Makefile
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/textproc/py-pdfrw/patches/patch-pdfrw_pdfreader.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/textproc/py-pdfrw/Makefile
diff -u pkgsrc/textproc/py-pdfrw/Makefile:1.4 pkgsrc/textproc/py-pdfrw/Makefile:1.5
--- pkgsrc/textproc/py-pdfrw/Makefile:1.4       Tue Jan  4 20:55:02 2022
+++ pkgsrc/textproc/py-pdfrw/Makefile   Thu Sep 28 22:19:36 2023
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.4 2022/01/04 20:55:02 wiz Exp $
+# $NetBSD: Makefile,v 1.5 2023/09/28 22:19:36 joerg Exp $
 
 DISTNAME=      pdfrw-0.4
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    textproc python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/pdfrw/}
 

Added files:

Index: pkgsrc/textproc/py-pdfrw/patches/patch-pdfrw_pdfreader.py
diff -u /dev/null pkgsrc/textproc/py-pdfrw/patches/patch-pdfrw_pdfreader.py:1.1
--- /dev/null   Thu Sep 28 22:19:37 2023
+++ pkgsrc/textproc/py-pdfrw/patches/patch-pdfrw_pdfreader.py   Thu Sep 28 22:19:37 2023
@@ -0,0 +1,30 @@
+$NetBSD: patch-pdfrw_pdfreader.py,v 1.1 2023/09/28 22:19:37 joerg Exp $
+
+Handle the case where the xref index starts with the free list, even if
+it is supposed to be at a non-zero offset.
+
+--- pdfrw/pdfreader.py.orig    2023-08-31 20:47:41.383788598 +0000
++++ pdfrw/pdfreader.py
+@@ -408,7 +408,9 @@ class PdfReader(PdfDict):
+                 if tok == 'trailer':
+                     return
+                 startobj = int(tok)
+-                for objnum in range(startobj, startobj + int(next())):
++                objnum = startobj
++                lastobj = int(next())
++                while objnum < startobj + lastobj:
+                     offset = int(next())
+                     generation = int(next())
+                     inuse = next()
+@@ -417,6 +419,11 @@ class PdfReader(PdfDict):
+                             setdefault((objnum, generation), offset)
+                     elif inuse != 'f':
+                         raise ValueError
++                    elif startobj and objnum==startobj and offset == 0 and generation == 65535:
++                        startobj = 0
++                        objnum = startobj
++                        log.warning('Invalid first object in non-zero-offset xref table, offset ignored')
++                    objnum += 1
+         except:
+             pass
+         try:



Home | Main Index | Thread Index | Old Index