FIX: fixed isOleFile issue when passing file content with len < MINIMAL_OLEFILE_SIZE

This commit is contained in:
Nazarii Gudzovatyi 2016-11-22 18:07:11 +02:00
parent 2e178d7dbb
commit e273ab04dc

View File

@ -449,7 +449,9 @@ def isOleFile(filename):
header = filename.read(len(MAGIC)) header = filename.read(len(MAGIC))
# just in case, seek back to start of file: # just in case, seek back to start of file:
filename.seek(0) filename.seek(0)
elif isinstance(filename, bytes) and len(filename) >= MINIMAL_OLEFILE_SIZE: elif isinstance(filename, bytes):
if len(filename) < MINIMAL_OLEFILE_SIZE:
return False
# 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: