Commit 31ce789a070a57c99b42c37b2634bfb296d86442
1 parent
959bc8d1
olefile: fixed slight bug in OleStream
Showing
1 changed file
with
2 additions
and
0 deletions
oletools/thirdparty/olefile/olefile.py
| ... | ... | @@ -195,6 +195,7 @@ __version__ = '0.44' |
| 195 | 195 | # - in OleStream use _raise_defect instead of exceptions |
| 196 | 196 | # 2016-04-27 - added support for incomplete streams and incorrect |
| 197 | 197 | # directory entries (to read malformed documents) |
| 198 | +# 2016-05-04 - fixed slight bug in OleStream | |
| 198 | 199 | |
| 199 | 200 | #----------------------------------------------------------------------------- |
| 200 | 201 | # TODO (for version 1.0): |
| ... | ... | @@ -857,6 +858,7 @@ class OleStream(io.BytesIO): |
| 857 | 858 | log.debug('Read data of length %d, less than expected stream size %d' % (len(data), size)) |
| 858 | 859 | # TODO: provide details in exception message |
| 859 | 860 | self.ole._raise_defect(DEFECT_INCORRECT, 'OLE stream size is less than declared') |
| 861 | + self.size = len(data) | |
| 860 | 862 | # when all data is read in memory, BytesIO constructor is called |
| 861 | 863 | io.BytesIO.__init__(self, data) |
| 862 | 864 | # Then the OleStream object can be used as a read-only file object. | ... | ... |