Commit 0c3e86bfede1706ba301a3298eff4c2d757b988d

Authored by kijeong kim
Committed by Philippe Lagadec
1 parent e71e7d54

msodde: add detecting an utf-16le dde string.

oletools/msodde.py
... ... @@ -275,6 +275,8 @@ def process_ole_field(data):
275 275 if data.lstrip().lower().startswith(u'dde'):
276 276 #log.debug('--> is DDE!')
277 277 return data
  278 + elif data.lstrip().lower().startswith(u'\00d\x00d\x00e\x00'):
  279 + return data
278 280 else:
279 281 return u''
280 282  
... ...
tests/msodde_doc/test_basic.py
... ... @@ -21,7 +21,7 @@ class TestReturnCode(unittest.TestCase):
21 21 def test_valid_doc(self):
22 22 """ check that a valid doc file leads to 0 exit status """
23 23 for filename in ('dde-test-from-office2003', 'dde-test-from-office2016',
24   - 'harmless-clean'):
  24 + 'harmless-clean', 'dde-test-from-office2013-utf_16le-korean'):
25 25 self.do_test_validity(join(BASE_DIR, 'msodde-doc',
26 26 filename + '.doc'))
27 27  
... ... @@ -108,6 +108,14 @@ class TestDdeInDoc(unittest.TestCase):
108 108 self.assertEqual(len(self.get_dde_from_output(capturer)), 0,
109 109 msg='Found dde links in output for doc file')
110 110  
  111 + def test_with_dde_utf16le(self):
  112 + """ check that dde links appear on stdout """
  113 + with OutputCapture() as capturer:
  114 + msodde.main([join(BASE_DIR, 'msodde-doc',
  115 + 'dde-test-from-office2013-utf_16le-korean.doc')])
  116 + self.assertNotEqual(len(self.get_dde_from_output(capturer)), 0,
  117 + msg='Found no dde links in output for doc file')
  118 +
111 119  
112 120 if __name__ == '__main__':
113 121 unittest.main()
... ...
tests/test-data/msodde-doc/dde-test-from-office2013-utf_16le-korean.doc 0 → 100644
No preview for this file type