diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:12:46 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:12:46 -0500 |
| commit | 0a464342469aab1ff3bf291308637244a15498fd (patch) | |
| tree | 1c33ecf663b0523c39d4de9f9fd637afde3fbf43 /runtime/src/pe_loader.cpp | |
| parent | db317bd3ee92560dbf9e4a27183ebc8a478c4a78 (diff) | |
| parent | 83d973a424afa3a5c21a52683154b770e4702065 (diff) | |
Merge pull request #1985 from Dominik
Diffstat (limited to 'runtime/src/pe_loader.cpp')
| -rw-r--r-- | runtime/src/pe_loader.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index a59f9d0b1..054598c6e 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp | |||
| @@ -65,7 +65,8 @@ uint64_t rva_in(const Module& m, uint64_t va, const char* what) { | |||
| 65 | 65 | ||
| 66 | IMAGE_TLS_DIRECTORY64* tls_directory(Module& m) { | 66 | IMAGE_TLS_DIRECTORY64* tls_directory(Module& m) { |
| 67 | auto* nt = at<IMAGE_NT_HEADERS64>(m.base, reinterpret_cast<IMAGE_DOS_HEADER*>(m.base)->e_lfanew); | 67 | auto* nt = at<IMAGE_NT_HEADERS64>(m.base, reinterpret_cast<IMAGE_DOS_HEADER*>(m.base)->e_lfanew); |
| 68 | const auto& dir = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS]; | 68 | // Through directory(), as every other directory: an entry past NumberOfRvaAndSizes is not a TLS directory. |
| 69 | const auto dir = directory(nt, IMAGE_DIRECTORY_ENTRY_TLS); | ||
| 69 | if (!dir.Size || !dir.VirtualAddress) return nullptr; | 70 | if (!dir.Size || !dir.VirtualAddress) return nullptr; |
| 70 | require_range(m.name, dir.VirtualAddress, sizeof(IMAGE_TLS_DIRECTORY64), m.size, "the TLS directory"); | 71 | require_range(m.name, dir.VirtualAddress, sizeof(IMAGE_TLS_DIRECTORY64), m.size, "the TLS directory"); |
| 71 | return at<IMAGE_TLS_DIRECTORY64>(m.base, dir.VirtualAddress); | 72 | return at<IMAGE_TLS_DIRECTORY64>(m.base, dir.VirtualAddress); |