Skip to content

Commit 149ebe0

Browse files
authored
Fix parsing the PLT on Windows (#2445)
* 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
1 parent dbb034a commit 149ebe0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ The table below shows which release corresponds to each branch, and what date th
118118
[2435]: https://github.com/Gallopsled/pwntools/pull/2435
119119
[2437]: https://github.com/Gallopsled/pwntools/pull/2437
120120

121+
## 4.13.1
122+
123+
- [#2445][2445] Fix parsing the PLT on Windows
124+
125+
[2445]: https://github.com/Gallopsled/pwntools/pull/2445
126+
121127
## 4.13.0 (`stable`)
122128

123129
- [#2242][2242] Term module revamp: activating special handling of terminal only when necessary

pwnlib/elf/plt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ def __ensure_memory_to_run_unicorn():
7070
mm.close()
7171
except OSError:
7272
raise OSError("Cannot allocate 1GB memory to run Unicorn Engine")
73+
except ImportError:
74+
# Can only mmap files on Windows, would need to use VirtualAlloc.
75+
pass
7376

7477

7578
def prepare_unicorn_and_context(elf, got, address, data):

0 commit comments

Comments
 (0)