fix(rboot): config parser must never brick boot - #673
Merged
Conversation
Real-hardware report: a mixed ESP (new rboot.conf with `resolution=auto`, old
BootX64.efi without auto support) died before drawing anything --
`panicked at src/config.rs:66: ParseIntError { kind: InvalidDigit }` -- because
the resolution parser unwrapped `"auto".parse::<usize>()`. The config file is
user-editable and version-skewed in practice, so the parser must degrade, not
panic.
Hardened every value parser in rboot's config:
- resolution: malformed/unknown values warn and fall back to Auto (which
itself falls back to keeping the current mode when EDID/GOP give nothing).
- kernel_stack_address / kernel_stack_size / physical_memory_offset:
malformed numbers warn and keep the built-in default. The hex parser also
no longer slices `&value[2..]` blind (out-of-bounds panic on short values)
and accepts values with or without the 0x prefix.
Verified: rboot builds, fmt/clippy clean; QEMU boots to the shell at the
auto-selected 1920x1080 with the hardened binary.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHCn5RNRcwR5PY1sYBHY2S
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.
Real-hardware report: a mixed ESP (new rboot.conf with
resolution=auto, old BootX64.efi without auto support) died before drawing anything --panicked at src/config.rs:66: ParseIntError { kind: InvalidDigit }-- because the resolution parser unwrapped"auto".parse::<usize>(). The config file is user-editable and version-skewed in practice, so the parser must degrade, not panic.Hardened every value parser in rboot's config:
&value[2..]blind (out-of-bounds panic on short values) and accepts values with or without the 0x prefix.Verified: rboot builds, fmt/clippy clean; QEMU boots to the shell at the auto-selected 1920x1080 with the hardened binary.
Claude-Session: https://claude.ai/code/session_01MHCn5RNRcwR5PY1sYBHY2S