fix: uninitialized read in ipv6_address_rule when "." has no preceding h16#994
Open
alandefreitas wants to merge 2 commits into
Open
fix: uninitialized read in ipv6_address_rule when "." has no preceding h16#994alandefreitas wants to merge 2 commits into
alandefreitas wants to merge 2 commits into
Conversation
|
An automated preview of the documentation is available at https://994.url.prtest2.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-05-12 15:42:39 UTC |
|
GCOVR code coverage report https://994.url.prtest2.cppalliance.org/gcovr/index.html Build time: 2026-05-12 15:54:49 UTC |
Setting the `CPPALLIANCE_AWS_POOL_DOWN` repository variable to `true` now forces all jobs onto public GitHub-hosted runners, so outages of the cppalliance AWS self-hosted pool no longer require a CI commit to revert. Default (unset / `false`) preserves the existing behavior for boostorg/url.
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.
fix #993
Parsing a URI whose IPv6 host contains
.with no precedingh16(for examplehttps://[::.) read uninitialized memory. The IPv6 rule'sbytesbuffer is filled ash16groups are parsed; when a.was encountered immediately after::(or at the very start), the parser tried to validate it as the first octet of an embedded IPv4 by callingmaybe_octet(&bytes[2*(7-n)]), but those bytes had never been written.In a constexpr context the compiler catches this as a hard error (the example from the issue):
At runtime it is undefined behavior.
The fix: In
include/boost/url/rfc/impl/ipv6_address_rule.hpp, the.branch now returnserror::invalidbefore themaybe_octetread when noh16has been parsed in the current segment. The parser already maintains a flagcthat means "anh16was parsed in the current segment" (set true after eachh16, reset to false after::), which is exactly the condition needed.This eliminates the uninitialized read on every reachable path while preserving acceptance of valid inputs like
::1.2.3.4(wherecistrueafter parsing the leading1).