Skip to content

Bug: IndexError when relocating image #314

Closed

Description

@pd-fkie

In PE.relocate_image on line 5484 the sixth element of the Optional Header Data Directories is accessed but when parsing the file given below
the list of data directories is empty resulting in an IndexError.

Affected code:

if self.OPTIONAL_HEADER.DATA_DIRECTORY[5].Size:

Exception:

Traceback (most recent call last):
  File "fuzz_pefile.py", line 21, in test_one_input
    p.relocate_image(0x40000)
  File "pefile.py", line 5484, in relocate_image
    if self.OPTIONAL_HEADER.DATA_DIRECTORY[5].Size:
IndexError: list index out of range

Crash file: crash-8499a0bb33aeba8f59a172584abc7ca0ab82a78c

Activity

  1. changed the title [-]Bugs: IndexError when relocating image[/-] [+]Bug: IndexError when relocating image[/+] on Feb 11, 2021
  2. erocarrera commented on May 13, 2021

    @erocarrera
    Owner

    Thanks for reporting!

  3. added a commit that references this issue on May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions