mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-17 18:54:46 +03:00
FIX: fixed isOleFile issue when passing file content with len < MINIMAL_OLEFILE_SIZE
This commit is contained in:
parent
2e178d7dbb
commit
70c5367c33
|
@ -453,6 +453,9 @@ def isOleFile(filename):
|
||||||
# filename is a bytes string containing the OLE file to be parsed:
|
# filename is a bytes string containing the OLE file to be parsed:
|
||||||
header = filename[:len(MAGIC)]
|
header = filename[:len(MAGIC)]
|
||||||
else:
|
else:
|
||||||
|
if len(filename) < MINIMAL_OLEFILE_SIZE:
|
||||||
|
return False
|
||||||
|
|
||||||
# string-like object: filename of file on disk
|
# string-like object: filename of file on disk
|
||||||
header = open(filename, 'rb').read(len(MAGIC))
|
header = open(filename, 'rb').read(len(MAGIC))
|
||||||
if header == MAGIC:
|
if header == MAGIC:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user