diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2024-06-07 00:24:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-06-08 15:36:21 -0400 |
| commit | 65cad8ab1398667bdc401cbdfaabfcd9cc8459d8 (patch) | |
| tree | ea15fa648a9bfd7e5d6c7371c85600eaa16614ee | |
| parent | 45b62c4529ee76f0bb6e948626a7fa6a8024e243 (diff) | |
| download | zig-65cad8ab1398667bdc401cbdfaabfcd9cc8459d8.tar.gz zig-65cad8ab1398667bdc401cbdfaabfcd9cc8459d8.zip | |
Fix index-of-out-bounds when no versions are found in the sdk lib dir
The current code wrongly assumes that versions[0] will always exist after the iterateAndFilterByVersion call.
| -rw-r--r-- | lib/std/zig/WindowsSdk.zig | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/std/zig/WindowsSdk.zig b/lib/std/zig/WindowsSdk.zig index 01a2e7d263..7e58b0f822 100644 --- a/lib/std/zig/WindowsSdk.zig +++ b/lib/std/zig/WindowsSdk.zig @@ -476,6 +476,7 @@ pub const Installation = struct { var iterator = sdk_lib_dir.iterate(); const versions = try iterateAndFilterByVersion(&iterator, allocator, prefix); + if (versions.len == 0) return error.InstallationNotFound; defer { for (versions[1..]) |version| allocator.free(version); allocator.free(versions); |
