Skip to content

various safety and correctness improvements#301

Open
phip1611 wants to merge 4 commits into
mainfrom
improvements
Open

various safety and correctness improvements#301
phip1611 wants to merge 4 commits into
mainfrom
improvements

Conversation

@phip1611

Copy link
Copy Markdown
Member

No description provided.

phip1611 added 4 commits June 22, 2026 11:01
Require Header implementors to report the full structure size and
derive payload_len() from it. Validate undersized reports before
building DynSizedStructure values, and use the reported total size for
tag iteration as well.

This makes the reported size the single source of truth. The old shape
spread the invariant across payload_len(), total_size(), and per-type
assertions, which was easy to drift out of sync. With one authoritative
value, the parsing code can validate once and reuse the same size for
construction, iteration, and downstream casts.

Update the concrete header types in multiboot2 and multiboot2-header
to the new contract, and add a regression test for a reported size that
is smaller than the fixed header.

Breaking: Header implementors now provide total_size() instead of
payload_len().
Make the RSDP constructors fill in the checksum fields themselves
so callers do not have to pass them in, and keep the builder tests
matched to that API change.

Validation now uses fixed-size slices for RSDP v1 and rejects bogus
v2 lengths before slicing, which removes the previous out-of-bounds
read risk from checksum validation.
@phip1611 phip1611 changed the title various improvements various safety and correctness improvements Jun 22, 2026
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.

1 participant