def test_nt_headers_exception(self):
"""pefile should fail parsing invalid data (missing NT headers)"""
# Take a known good file.
control_file = os.path.join(REGRESSION_TESTS_DIR, 'MSVBVM60.DLL')
pe = pefile.PE(control_file, fast_load=True)
# Truncate it at the PE header and add invalid data.
pe_header_offest = pe.DOS_HEADER.e_lfanew
corrupted_data = pe.__data__[:pe_header_offest] + b'\0' * (1024 * 10)
self.assertRaises(pefile.PEFormatError, pefile.PE, data=corrupted_data)
评论列表
文章目录