Skip to content

Add a guard against an empty range in the EXT4 formatter#641

Merged
wlan0 merged 2 commits intoapple:mainfrom
dkovba:empty-range
Apr 4, 2026
Merged

Add a guard against an empty range in the EXT4 formatter#641
wlan0 merged 2 commits intoapple:mainfrom
dkovba:empty-range

Conversation

@dkovba
Copy link
Copy Markdown
Contributor

@dkovba dkovba commented Apr 3, 2026

Adds a guard against an empty range in the EXT4 formatter to prevent a possible crash:

Swift/arm64e-apple-macos.swiftinterface:6314: Fatal error: Range requires lowerBound <= upperBound

@dkovba dkovba requested a review from wlan0 April 3, 2026 05:36
@wlan0
Copy link
Copy Markdown
Contributor

wlan0 commented Apr 3, 2026

I agree that this loop would need guarding if the lower bound could exceed the upper bound, but with the current math I can’t find a reachable state where that happens.

Can you add a failing regression test or share the exact formatter input that makes
usedGroupDescriptorBlocks + 1 > self.groupDescriptorBlocks ?

@dkovba
Copy link
Copy Markdown
Contributor Author

dkovba commented Apr 3, 2026

@wlan0 Added a test reproducing the crash. However, to reproduce the crash, I had to remove reserved blocks in groupDescriptorBlocks:

-            ((groupCount - 1) / groupsPerDescriptorBlock + 1) * 32                                           
+            (groupCount - 1) / groupsPerDescriptorBlock + 1 

@wlan0 wlan0 merged commit 587339a into apple:main Apr 4, 2026
3 checks passed
@dkovba dkovba deleted the empty-range branch April 4, 2026 02:07
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.

2 participants