Repository navigation
Fix an out-of-bounds read in the XML archive signature check - #394
Open
gennaroprota wants to merge 1 commit into
Open
gennaroprota wants to merge 1 commit into
gennaroprota wants to merge 1 commit into
Conversation
gennaroprota
force-pushed
the
fix-an-out-of-bounds-read-in-the-xml-archive-signature-check
branch
3 times, most recently
from
November 25, 2026 15:04
5b8930f to
89731f7
Compare
`basic_xml_grammar<>::init()` compared the signature in the header of an XML archive with `BOOST_ARCHIVE_SIGNATURE()` using the three-iterator `std::equal()`, which reads as many characters of the expected signature as the archive provides. So a longer signature made it read past the end of the expected one, and any prefix of it, such as "serialization", was accepted. We now compare the lengths first, as "fix address sanitizer exception when loading corrupted XML archive. GitHub issue #257" did for the tag names in `load_end()`. Note that the test can only catch the accepted prefix: the read past the end goes unnoticed without a sanitizer, and CI runs none. Fixes #392.
gennaroprota
force-pushed
the
fix-an-out-of-bounds-read-in-the-xml-archive-signature-check
branch
from
November 25, 2026 15:06
89731f7 to
ee1e45d
Compare
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.
basic_xml_grammar<>::init()compared the signature in the header of an XML archive withBOOST_ARCHIVE_SIGNATURE()using the three-iteratorstd::equal(), which reads as many characters of the expected signature as the archive provides. So a longer signature made it read past the end of the expected one, and any prefix of it, such as "serialization", was accepted. We now compare the lengths first, as "fix address sanitizer exception when loading corrupted XML archive. GitHub issue #257" did for the tag names inload_end().Note that the test can only catch the accepted prefix: the read past the end goes unnoticed without a sanitizer, and CI runs none.
Closes #392.