Fix two separate El Torito bugs. - #183
Merged
Merged
Conversation
1. The OpenBSD ISO apparently uses 0xdf instead of 0x00 for padding, which means our earlier heuristic for determining the end of the El Torito section (used for FreeBSD) didn't work there. Now we instead make sure that the number of sections equals the number we were told at the beginning, ignoring the padding. That makes it work for both, even in the absence of a proper terminator. 2. Running "genisoimage -no-boot" created an ISO that we couldn't parse because it added in 0x00 in the list, and 0x00 was being handled up-front so could never be hit later. 0x0 is unfortunately ambiguous; it means both non-bootable entry and terminator simultaneously, so we have to use context to figure out which one we should do. If the last section header still needs an entry, and the record has non-zero content, we treat it as a non-bootable entry. Otherwise we treat it as the terminator. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
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.
The OpenBSD ISO apparently uses 0xdf instead of 0x00 for padding, which means our earlier heuristic for determining the end of the El Torito section (used for FreeBSD) didn't work there. Now we instead make sure that the number of sections equals the number we were told at the beginning, ignoring the padding. That makes it work for both, even in the absence of a proper terminator.
Running "genisoimage -no-boot" created an ISO that we couldn't parse because it added in 0x00 in the list, and 0x00 was being handled up-front so could never be hit later. 0x0 is unfortunately ambiguous; it means both non-bootable entry and terminator simultaneously, so we have to use context to figure out which one we should do. If the last section header still needs an entry, and the record has non-zero content, we treat it as a non-bootable entry. Otherwise we treat it as the terminator.
This fixes #180