authorgravatar for 46715729+salo-dea@users.noreply.github.comsalo-dea <46715729+salo-dea@users.noreply.github.com> 2023-11-10 17:04:08+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-11-21 15:21:41+02:00
loga58ecf7b090f744975cf3816204fe0e891ff73ba
tree511c7404f80cb92609076604df37a70bd9b6e7f4
parentdc72f17d8026c73acda90f107690c14327173c5f

Do not assume that FILE_BOTH_DIR_INFORMATION is correctly aligned


1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/fs.zig+3-1
......@@ -749,7 +749,9 @@ pub const IterableDir = struct {
749749 }
750750 }
751751
752 const dir_info: *w.FILE_BOTH_DIR_INFORMATION = @ptrCast(@alignCast(&self.buf[self.index]));
752 // While the official api docs guarantee FILE_BOTH_DIR_INFORMATION to be aligned properly
753 // this may not always be the case (e.g. due to faulty VM/Sandboxing tools)
754 const dir_info: *align(2) w.FILE_BOTH_DIR_INFORMATION = @ptrCast(@alignCast(&self.buf[self.index]));
753755 if (dir_info.NextEntryOffset != 0) {
754756 self.index += dir_info.NextEntryOffset;
755757 } else {