Commit 09d42b43bcbac34a0c73c694f16eda43975026d8

Authored by Pavol Plaskoň
1 parent 5fe3fd31

Fix ignoring of optional whitespace after \bin.

The condition was always False because self.data[self.index] returns integer.

Try to put this in code before the condition:
>>> print(type(self.data[self.index]))  # <class 'int'>
>>> print(self.data[self.index])        # 32

Thus even with space at self.index it fails:
>>> 32 == ' '  # False
Showing 1 changed file with 1 additions and 1 deletions
oletools/rtfobj.py
... ... @@ -578,7 +578,7 @@ class RtfParser(object):
578 578 # it should be treated as a null length:
579 579 binlen=0
580 580 # ignore optional space after \bin
581   - if self.data[self.index] == ' ':
  581 + if self.data[self.index] == ord(' '):
582 582 log.debug('\\bin: ignoring whitespace before data')
583 583 self.index += 1
584 584 log.debug('\\bin: reading %d bytes of binary data' % binlen)
... ...