Repository navigation
fix(h3 ffi): validate raw slice pointer metadata - #2794
Open
codeandsolder wants to merge 1 commit into
Open
codeandsolder wants to merge 1 commit into
codeandsolder wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
Validate HTTP/3 C-FFI raw buffer/header pointer metadata before constructing Rust slices.
This is the HTTP/3 counterpart to #2790, kept separate so the transport and H3 surfaces remain independently reviewable.
Problems addressed
The H3 FFI currently constructs slices directly from caller-provided pointers and lengths. Invalid C metadata can therefore violate Rust slice preconditions before quiche gets a chance to return an error. Oversized body lengths also panic instead of using the FFI error channel.
Change
QUICHE_H3_ERR_INVALID_ARGUMENT = -21;slice::from_raw_parts(_mut);NULL + len == 0by constructing an aligned empty slice;HeaderRefs;Validation
Rebased directly onto current upstream
master(3fc9bc1c). On Rust 1.98.1 with--features ffi:h3_header_slices_accept_null_zero_and_reject_bad_parts: passoversized_h3_ffi_length_returns_invalid_argument: passFormatting with the repository's nightly rustfmt configuration and
git diff --checkare clean.