Skip to content

Commit abc06f9

Browse files
authored
Fix incorrect inequality and add tests (#15)
Fix incorrect inequality and add tests
2 parents 6a66694 + 6f8ebd4 commit abc06f9

File tree

7 files changed

+116
-3
lines changed

7 files changed

+116
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ os:
55
- osx
66
julia:
77
- 1.0
8+
- 1.3
89
- nightly
910
notifications:
1011
email: false

Manifest.toml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
[[Base64]]
4+
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
5+
6+
[[Dates]]
7+
deps = ["Printf"]
8+
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
9+
10+
[[Distributed]]
11+
deps = ["Random", "Serialization", "Sockets"]
12+
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
13+
14+
[[InteractiveUtils]]
15+
deps = ["Markdown"]
16+
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
17+
18+
[[LibGit2]]
19+
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
20+
21+
[[Logging]]
22+
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
23+
24+
[[Markdown]]
25+
deps = ["Base64"]
26+
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
27+
28+
[[Pkg]]
29+
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
30+
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
31+
32+
[[Printf]]
33+
deps = ["Unicode"]
34+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
35+
36+
[[REPL]]
37+
deps = ["InteractiveUtils", "Markdown", "Sockets"]
38+
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
39+
40+
[[Random]]
41+
deps = ["Serialization"]
42+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
43+
44+
[[Reexport]]
45+
deps = ["Pkg"]
46+
git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
47+
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
48+
version = "0.2.0"
49+
50+
[[SHA]]
51+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
52+
53+
[[Serialization]]
54+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
55+
56+
[[Sockets]]
57+
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
58+
59+
[[StructIO]]
60+
deps = ["Test"]
61+
git-tree-sha1 = "010dc73c7146869c042b49adcdb6bf528c12e859"
62+
uuid = "53d494c1-5632-5724-8f4c-31dff12d585f"
63+
version = "0.3.0"
64+
65+
[[Test]]
66+
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
67+
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
68+
69+
[[UUIDs]]
70+
deps = ["Random", "SHA"]
71+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
72+
73+
[[Unicode]]
74+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

Project.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name = "ObjectFile"
2+
uuid = "d8793406-e978-5875-9003-1fc021f44a92"
3+
authors = ["Elliot Saba <[email protected]>"]
4+
version = "0.3.3"
5+
6+
[deps]
7+
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
8+
StructIO = "53d494c1-5632-5724-8f4c-31dff12d585f"
9+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
10+
11+
[compat]
12+
StructIO = "≥ 0.3"
13+
julia = "≥ 1"

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

test/win32/WhoUses.exe

106 KB
Binary file not shown.

test/win32/msobj140.dll

104 KB
Binary file not shown.

0 commit comments

Comments
 (0)