-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minimal gpt partition size is wrong #143
Comments
Are you suggesting that this: case start >= 0 && end > start && size == calculatedSize: should be case start >= 0 && end >= start && size == calculatedSize: To be honest, this line is a bit in error in that it doesn't do anything, as it is a lone |
yes. go-diskfs/partition/gpt/partiton.go Line 150 in 8ff8bc6
go-diskfs/partition/gpt/partiton.go Line 253 in 8ff8bc6
go-diskfs/partition/gpt/partiton.go Line 254 in 8ff8bc6
should allow end == start I assume go-diskfs/partition/gpt/partiton.go Line 152 in 8ff8bc6
should be case p.Size != 0 && p.End < p.Start: or case p.Size != 0 && p.End == 0 (btw p.Size <= 0 is the same same p.Size == 0 as it is unsigned but I guess that is more about preference) |
Happy to take a PR on it. |
in partition/gpt/partition.go are multiple checks for end > start.
(e.g.
go-diskfs/partition/gpt/partiton.go
Line 253 in 8ff8bc6
Both start and end represent sectors with start the first and end the last sector of the partition. so the minimal allowed sector size of a partition becomes 2 while it should be 1.
this is somewhat correctly reflected in
go-diskfs/partition/gpt/partiton.go
Line 257 in 8ff8bc6
if size equals blocksize (but it would create an invalid result for 0 < size < blocksize, with end = start-1).
The code will fail later on in a second check for end > start.
The text was updated successfully, but these errors were encountered: