Skip to content

Commit

Permalink
Reformatted with black
Browse files Browse the repository at this point in the history
  • Loading branch information
erocarrera committed Mar 6, 2022
1 parent 2a6e328 commit e351420
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5378,14 +5378,14 @@ def parse_import_directory(self, rva, size, dllnames_only=False):

import_descs = []
error_count = 0
image_import_descriptor_size = Structure(self.__IMAGE_IMPORT_DESCRIPTOR_format__).sizeof()
image_import_descriptor_size = Structure(
self.__IMAGE_IMPORT_DESCRIPTOR_format__
).sizeof()
while True:
try:
# If the RVA is invalid all would blow up. Some EXEs seem to be
# specially nasty and have an invalid RVA.
data = self.get_data(
rva, image_import_descriptor_size
)
data = self.get_data(rva, image_import_descriptor_size)
except PEFormatError:
self.__warnings.append(
f"Error parsing the import directory at RVA: 0x{rva:x}"
Expand Down Expand Up @@ -5660,7 +5660,7 @@ def get_import_table(self, rva, max_length=None, contains_addresses=False):

expected_size = Structure(format).sizeof()
MAX_ADDRESS_SPREAD = 128 * 2**20 # 128 MB
ADDR_4GB = 2 ** 32
ADDR_4GB = 2**32
MAX_REPEATED_ADDRESSES = 15
repeated_address = 0
addresses_of_data_set_64 = AddressSet()
Expand Down Expand Up @@ -5690,9 +5690,9 @@ def get_import_table(self, rva, max_length=None, contains_addresses=False):
# if the addresses point somewhere but the difference between the highest
# and lowest address is larger than MAX_ADDRESS_SPREAD we assume a bogus
# table as the addresses should be contained within a module
if (addresses_of_data_set_32.diff() > MAX_ADDRESS_SPREAD):
if addresses_of_data_set_32.diff() > MAX_ADDRESS_SPREAD:
return []
if (addresses_of_data_set_64.diff() > MAX_ADDRESS_SPREAD):
if addresses_of_data_set_64.diff() > MAX_ADDRESS_SPREAD:
return []

failed = False
Expand Down

0 comments on commit e351420

Please sign in to comment.