authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-30 17:04:13-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-25 13:48:43-04:00
log0fa89dc51d6bb92f36ceb1399e07aa6f7c1dbd2b
tree03e378ff1a1df9f57c245d7acbb758e81804a958
parentf13c67bcfed1c509abd13e83ae36479b793583d2

Fix read from null pointer in CacheHash.hit

It occured when the manifest file was manually edited to include an extra file. Now it will simply copy the file name in the manifest file

1 files changed, 4 insertions(+), 0 deletions(-)

lib/std/cache_hash.zig+4
...@@ -186,6 +186,10 @@ pub const CacheHash = struct {...@@ -186,6 +186,10 @@ pub const CacheHash = struct {
186 return error.InvalidFormat;186 return error.InvalidFormat;
187 }187 }
188188
189 if (cache_hash_file.path == null) {
190 cache_hash_file.path = try mem.dupe(self.alloc, u8, file_path);
191 }
192
189 const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch {193 const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch {
190 return error.CacheUnavailable;194 return error.CacheUnavailable;
191 };195 };