Repository navigation
# FAT reader no longer recurses forever into cyclic directories - #810
Merged
Merged
Conversation
Symptom (#805): reading a damaged FAT image killed the process with a stack overflow (seen on cryptsetup's BitLocker To Go test images, whose zeroed sectors decrypt to a garbage FAT16). Root cause: ReadDirectoryEntries descends into every subdirectory entry and nothing remembered which directories had been read, so a subdirectory whose start cluster points back at an ancestor - or at itself - was entered again and again. Cluster chains already had a loop guard; directory recursion did not. Fix: track the start clusters of directories already read and skip a directory that has been visited, keeping the entries read so far. Verified: new FatCorruptDirectoryTests reproduce the crash (test host "Stack overflow") before the fix and pass after it, for a parent cycle and a self cycle; a 20-level valid tree is still listed completely; all 312 FAT tests pass. Closes #805
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A subdirectory entry pointing back at an ancestor (or itself) made
FatReaderrecurse until the stack overflowed and killed the process. The reader now remembers which directory clusters it has read and does not enter one twice.Verification
FatCorruptDirectoryTests: parent and self cycles crashed the test host before the fix ("Stack overflow") and pass after it; a valid 20-level tree is still fully listed.Closes #805