You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/msoffcrypto/format/xls97.py", line 644, in is_encrypted
if not workbook.has_record(recordNameNum["FilePass"]):
File "/usr/local/lib/python3.10/dist-packages/msoffcrypto/format/xls97.py", line 418, in has_record
num, size = unpack("<HH", h)
struct.error: unpack requires a buffer of 4 bytes
Unfortunately I cannot share the file that triggers this exception.
But looking at xls97.py line 418, the code assumes that self.data.read(4) returns either exactly 4 bytes or nothing:
Thank you for reporting! This bug doesn't seem easy, and I can't think of a way to debug it without a sample. However, if I figure something out in the future, I will make fixes. Any information is also welcome.
(A quick possible fix would be changing if not h: to if not h or len(h) < 4:, but I'm not sure if it is consistent with the spec.)
Unfortunately I cannot share the file that triggers this exception.
But looking at
xls97.py
line 418, the code assumes thatself.data.read(4)
returns either exactly 4 bytes or nothing:msoffcrypto-tool/msoffcrypto/format/xls97.py
Lines 411 to 423 in f727b42
I'm not sure what
self.data
there is but normallyread(n)
is guaranteed to return at most 4 bytes, not exactly 4 bytes.The text was updated successfully, but these errors were encountered: