Gregwar/fatcat

fatcat does not support `BPB_RootClus != 2`

ntlhui-tdy opened this issue · 0 comments

Per the Microsoft Extensible Firmware Initiative FAT32 File System Specification (https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx), BPB_RootClus, which stores the cluster number of the first cluster of the root directory, is usually 2, but not required to be 2. This can be set to values others than 2 if cluster 2 is marked bad.

The check for this occurs at https://github.com/Gregwar/fatcat/blob/master/src/core/FatSystem.cpp#L190.

We found an instance where a superfloppy volume formatted on Windows 10 placed the root directory at cluster 4. fatcat was unable to load the filesystem, yielding the following error message:

sudo fatcat /dev/loop0 -i -l /
WARNING: Root directory is not 2 (4)
! Failed to init the FAT filesystem