Commit 03202cd9bb15873f4a5b640bbb11f1db8a8f3b57

Authored by Jürgen Löhel
1 parent 75c06966

Fixes OleID constructor

It's necessary to set self.data if data is not None.

Fixes: #695

Signed-off-by: Jürgen Löhel <juergen.loehel@inlyse.com>
Showing 1 changed file with 2 additions and 0 deletions
oletools/oleid.py
@@ -235,6 +235,8 @@ class OleID(object): @@ -235,6 +235,8 @@ class OleID(object):
235 self.file_on_disk = True # useful for some check that don't work in memory 235 self.file_on_disk = True # useful for some check that don't work in memory
236 with open(filename, 'rb') as f: 236 with open(filename, 'rb') as f:
237 self.data = f.read() 237 self.data = f.read()
  238 + else:
  239 + self.data = data
238 self.data_bytesio = io.BytesIO(self.data) 240 self.data_bytesio = io.BytesIO(self.data)
239 if isinstance(filename, olefile.OleFileIO): 241 if isinstance(filename, olefile.OleFileIO):
240 self.ole = filename 242 self.ole = filename