Skip to content

Commit bec8ad8

Browse files
committed
Fix incorrect inequality and add tests
1 parent 6a66694 commit bec8ad8

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/COFF/COFFDynamicLink.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ end
2626

2727
function find_section_for_rva(oh::H, rva) where {H <: COFFHandle}
2828
for s in Sections(oh)
29-
if section_address(s) < rva && section_address(s) + section_size(s) > rva
29+
if section_address(s) <= rva && section_address(s) + section_size(s) > rva
3030
return s
3131
end
3232
end
33-
error("Unable to find section for RVA $(rva)")
33+
error("Unable to find section for RVA $(repr(rva))")
3434
end
3535

3636
function COFFDynamicLinks(oh::H) where {H <: COFFHandle}

test/runtests.jl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,29 @@ test_libfoo_and_fooifier("./win64/fooifier.exe", "./win64/libfoo.dll")
176176
version_symbols = filter(x -> startswith(x, "GLIBCXX_"), version_symbols)
177177
max_version = maximum([VersionNumber(split(v, "_")[2]) for v in version_symbols])
178178
@test max_version == v"3.4.25"
179-
end
179+
end
180+
181+
182+
# Ensure that these tricksy win32 files work
183+
@testset "git win32 problems" begin
184+
# Test that 6a66694a8dd5ca85bd96fe6236f21d5b183e7de6 fix worked
185+
libmsobj_path = "./win32/msobj140.dll"
186+
187+
dynamic_links = readmeta(libmsobj_path) do oh
188+
path.(DynamicLinks(oh))
189+
end
190+
191+
@test "KERNEL32.dll" in dynamic_links
192+
@test "api-ms-win-crt-heap-l1-1-0.dll" in dynamic_links
193+
@test "api-ms-win-crt-convert-l1-1-0.dll" in dynamic_links
194+
@test "api-ms-win-crt-runtime-l1-1-0.dll" in dynamic_links
195+
196+
whouses_exe = "./win32/WhoUses.exe"
197+
dynamic_links = readmeta(whouses_exe) do oh
198+
path.(DynamicLinks(oh))
199+
end
200+
201+
@test "ADVAPI32.dll" in dynamic_links
202+
@test "KERNEL32.dll" in dynamic_links
203+
@test "libstdc++-6.dll" in dynamic_links
204+
end

0 commit comments

Comments
 (0)