diff --git a/oletools/msodde.py b/oletools/msodde.py index 59c16fe..e7862cb 100644 --- a/oletools/msodde.py +++ b/oletools/msodde.py @@ -275,6 +275,8 @@ def process_ole_field(data): if data.lstrip().lower().startswith(u'dde'): #log.debug('--> is DDE!') return data + elif data.lstrip().lower().startswith(u'\00d\x00d\x00e\x00'): + return data else: return u'' diff --git a/tests/msodde_doc/test_basic.py b/tests/msodde_doc/test_basic.py index ec6ead8..33da7dd 100644 --- a/tests/msodde_doc/test_basic.py +++ b/tests/msodde_doc/test_basic.py @@ -21,7 +21,7 @@ class TestReturnCode(unittest.TestCase): def test_valid_doc(self): """ check that a valid doc file leads to 0 exit status """ for filename in ('dde-test-from-office2003', 'dde-test-from-office2016', - 'harmless-clean'): + 'harmless-clean', 'dde-test-from-office2013-utf_16le-korean'): self.do_test_validity(join(BASE_DIR, 'msodde-doc', filename + '.doc')) @@ -108,6 +108,14 @@ class TestDdeInDoc(unittest.TestCase): self.assertEqual(len(self.get_dde_from_output(capturer)), 0, msg='Found dde links in output for doc file') + def test_with_dde_utf16le(self): + """ check that dde links appear on stdout """ + with OutputCapture() as capturer: + msodde.main([join(BASE_DIR, 'msodde-doc', + 'dde-test-from-office2013-utf_16le-korean.doc')]) + self.assertNotEqual(len(self.get_dde_from_output(capturer)), 0, + msg='Found no dde links in output for doc file') + if __name__ == '__main__': unittest.main() diff --git a/tests/test-data/msodde-doc/dde-test-from-office2013-utf_16le-korean.doc b/tests/test-data/msodde-doc/dde-test-from-office2013-utf_16le-korean.doc new file mode 100644 index 0000000..6d0bec8 --- /dev/null +++ b/tests/test-data/msodde-doc/dde-test-from-office2013-utf_16le-korean.doc