From 901a6c091d116b232044a803e5eaf337bcb115c0 Mon Sep 17 00:00:00 2001 From: NoDRM Date: Fri, 23 Dec 2022 10:42:25 +0100 Subject: [PATCH] Fix exception in error logging in ineptpdf --- DeDRM_plugin/ineptpdf.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DeDRM_plugin/ineptpdf.py b/DeDRM_plugin/ineptpdf.py index adb9937..ea509ad 100755 --- a/DeDRM_plugin/ineptpdf.py +++ b/DeDRM_plugin/ineptpdf.py @@ -1636,13 +1636,15 @@ class PDFDocument(object): else: print("ebx_V is %d and ebx_type is %d" % (ebx_V, ebx_type)) print("length is %d and len(bookkey) is %d" % (length, len(bookkey))) - print("bookkey[0] is %d" % bookkey[0]) + if len(bookkey) > 0: + print("bookkey[0] is %d" % bookkey[0]) raise ADEPTError('error decrypting book session key - mismatched length') else: # proper length unknown try with whatever you have print("ebx_V is %d and ebx_type is %d" % (ebx_V, ebx_type)) print("length is %d and len(bookkey) is %d" % (length, len(bookkey))) - print("bookkey[0] is %d" % ord(bookkey[0])) + if len(bookkey) > 0: + print("bookkey[0] is %d" % ord(bookkey[0])) if ebx_V == 3: V = 3 else: @@ -1708,13 +1710,15 @@ class PDFDocument(object): else: print("ebx_V is %d and ebx_type is %d" % (ebx_V, ebx_type)) print("length is %d and len(bookkey) is %d" % (length, len(bookkey))) - print("bookkey[0] is %d" % bookkey[0]) + if len(bookkey) > 0: + print("bookkey[0] is %d" % bookkey[0]) raise ADEPTError('error decrypting book session key - mismatched length') else: # proper length unknown try with whatever you have print("ebx_V is %d and ebx_type is %d" % (ebx_V, ebx_type)) print("length is %d and len(bookkey) is %d" % (length, len(bookkey))) - print("bookkey[0] is %d" % bookkey[0]) + if len(bookkey) > 0: + print("bookkey[0] is %d" % bookkey[0]) if ebx_V == 3: V = 3 else: