Skip to content

Commit

Permalink
Fix parsing the PLT on Windows (#2445)
Browse files Browse the repository at this point in the history
* Fix parsing the PLT on Windows

The Unicorn Engine 1GB workaround doesn't work since `mmap` has different semantics on Windows.

* Update CHANGELOG

* Catch ImportError instead

* Remove unused sys import
  • Loading branch information
peace-maker authored Sep 25, 2024
1 parent dbb034a commit 149ebe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ The table below shows which release corresponds to each branch, and what date th
[2435]: https://github.com/Gallopsled/pwntools/pull/2435
[2437]: https://github.com/Gallopsled/pwntools/pull/2437

## 4.13.1

- [#2445][2445] Fix parsing the PLT on Windows

[2445]: https://github.com/Gallopsled/pwntools/pull/2445

## 4.13.0 (`stable`)

- [#2242][2242] Term module revamp: activating special handling of terminal only when necessary
Expand Down
3 changes: 3 additions & 0 deletions pwnlib/elf/plt.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def __ensure_memory_to_run_unicorn():
mm.close()
except OSError:
raise OSError("Cannot allocate 1GB memory to run Unicorn Engine")
except ImportError:
# Can only mmap files on Windows, would need to use VirtualAlloc.
pass


def prepare_unicorn_and_context(elf, got, address, data):
Expand Down

0 comments on commit 149ebe0

Please sign in to comment.