I use some FAT32 filesystem from a file image. It has errors, so I tried to check it with fsck_msdosfs /dev/md0 and got this: ** /dev/md0 Floating exception (core dumped) I compiled fsck_msdosfs with debug information and found the faulty code block at /usr/src/sbin/fsck_msdosfs/boot.c:174 boot->ClusterOffset = (boot->RootDirEnts * 32 + boot->BytesPerSec - 1) / boot->BytesPerSec + boot->ResSectors + boot->FATs * boot->FATsecs - CLUST_FIRST * boot->SecPerClust; It fails because in my case boot->BytesPerSec == 0. IMHO such condition should be checked, fixed in the FS, but not crashed.
Responsible Changed From-To: freebsd-bugs->freebsd-fs Over to maintainer(s).
This should avoid the divide by 0, but I'd need to verify that the behavior is correct: https://people.freebsd.org/~ngie/bug127270.patch This situation should occur if and when boot blocks 12 and 13 are 0, but there might need to be some additional conditions that need to be tripped in order for the divide by 0 to occur: 66 boot->bpbBytesPerSec = block[11] + (block[12] << 8);
Handing a number of makefs, mtree, and msdosfs bugs in my queue over to emaste@.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Reset asignee - I am not currently looking at this PR.
I think this was fixed in r335696, which will check the BPB BytesPerSec field and bail out. This was merged to stable/11 (r336218) so closing this PR.