Skip to content

Zero-fill clusters allocated for the FAT32 root directory - #69

Closed
william-spinelli wants to merge 1 commit into
MabezDev:masterfrom
william-spinelli:zero-fill-root-clusters
Closed

william-spinelli wants to merge 1 commit into
MabezDev:masterfrom
william-spinelli:zero-fill-root-clusters

Conversation

@william-spinelli

@william-spinelli william-spinelli commented Jul 29, 2026 •

Copy link
Copy Markdown

File::is_dir returned false for streams without a directory entry, but the only such stream is the FAT32 root directory. When the root directory grew past its last cluster, the newly allocated cluster was therefore not zero-filled: it kept stale data from previously deleted files, which has no end-of-directory marker and gets parsed as directory entries.

Creating enough files (e.g. hundreds of entries with long file names) reliably produced bogus files and directories with garbled names and dates, even after a clean unmount.
image

Treat entry-less streams as directories so alloc_cluster zeroes the new cluster.

File::is_dir returned false for streams without a directory entry, but
the only such stream is the FAT32 root directory. When the root
directory grew past its last cluster, the newly allocated cluster was
therefore not zero-filled: it kept stale data from previously deleted
files, which has no end-of-directory marker and gets parsed as
directory entries. Creating enough files (e.g. hundreds of entries
with long file names) reliably produced bogus files and directories
with garbled names and dates, even after a clean unmount.

Treat entry-less streams as directories so alloc_cluster zeroes the
new cluster.
@kdm9

kdm9 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

this got fixed in #70, along with some tests of the underlying issue, so can be closed.

@MabezDev MabezDev closed this Aug 28, 2026
@william-spinelli

Copy link
Copy Markdown
Author

Well thanks anyway :)

@william-spinelli
william-spinelli deleted the zero-fill-root-clusters branch August 28, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants