Commit 0c3e86bfede1706ba301a3298eff4c2d757b988d
Committed by
Philippe Lagadec
1 parent
e71e7d54
msodde: add detecting an utf-16le dde string.
Showing
3 changed files
with
11 additions
and
1 deletions
oletools/msodde.py
| @@ -275,6 +275,8 @@ def process_ole_field(data): | @@ -275,6 +275,8 @@ def process_ole_field(data): | ||
| 275 | if data.lstrip().lower().startswith(u'dde'): | 275 | if data.lstrip().lower().startswith(u'dde'): |
| 276 | #log.debug('--> is DDE!') | 276 | #log.debug('--> is DDE!') |
| 277 | return data | 277 | return data |
| 278 | + elif data.lstrip().lower().startswith(u'\00d\x00d\x00e\x00'): | ||
| 279 | + return data | ||
| 278 | else: | 280 | else: |
| 279 | return u'' | 281 | return u'' |
| 280 | 282 |
tests/msodde_doc/test_basic.py
| @@ -21,7 +21,7 @@ class TestReturnCode(unittest.TestCase): | @@ -21,7 +21,7 @@ class TestReturnCode(unittest.TestCase): | ||
| 21 | def test_valid_doc(self): | 21 | def test_valid_doc(self): |
| 22 | """ check that a valid doc file leads to 0 exit status """ | 22 | """ check that a valid doc file leads to 0 exit status """ |
| 23 | for filename in ('dde-test-from-office2003', 'dde-test-from-office2016', | 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 | self.do_test_validity(join(BASE_DIR, 'msodde-doc', | 25 | self.do_test_validity(join(BASE_DIR, 'msodde-doc', |
| 26 | filename + '.doc')) | 26 | filename + '.doc')) |
| 27 | 27 | ||
| @@ -108,6 +108,14 @@ class TestDdeInDoc(unittest.TestCase): | @@ -108,6 +108,14 @@ class TestDdeInDoc(unittest.TestCase): | ||
| 108 | self.assertEqual(len(self.get_dde_from_output(capturer)), 0, | 108 | self.assertEqual(len(self.get_dde_from_output(capturer)), 0, |
| 109 | msg='Found dde links in output for doc file') | 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 | if __name__ == '__main__': | 120 | if __name__ == '__main__': |
| 113 | unittest.main() | 121 | unittest.main() |
tests/test-data/msodde-doc/dde-test-from-office2013-utf_16le-korean.doc
0 → 100644
No preview for this file type