Repository navigation
🐛 fix(fuzz): unbreak the sanitizer smoke gate - #2546
Merged
Merged
Conversation
th_tag_key loads a whole 8-byte word of the tag name. The tokenizer's name buffer relied on the growth policy's 16-byte first allocation for that, but the fuzz build starts every buffer at two bytes, so every short tag read past its buffer under ASan. Reserving the word itself keeps release builds at 16 bytes and makes the fuzz build honor the contract.
When the open-element block summaries could not grow, the pushed element stayed on the stack without a summary slot, and the pop that unwinds the failed parse read past the summary array. The push is now undone on that failure. select_cache_finish also formed NULL plus zero when the first select cache allocation failed; it now walks the caches by index.
url_percent_encode_slow returned NULL without an exception when its output buffer could not be allocated, so link resolution surfaced SystemError instead of MemoryError.
A failing sanitizer self-check now says which report kind fired instead, so an unrelated memory error hiding behind it shows in the log. Only the kind is printed: the stack would publish an unfixed bug's location.
gaborbernat
force-pushed
the
fix/fuzz-self-check
branch
from
November 21, 2026 00:56
ddcdd86 to
bf04f91
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
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.
The scheduled fuzz workflow has failed every day since 2026-11-15. Its sanitizer self-check runs each
_fuzz_crashkind underPYTHONMALLOC=mallocand expects that kind's ASan report. Since #1988,parse()itself reads past the tag-name buffer in the fuzz build, so the first fault kind that parses got aheap-buffer-overflowreport instead of its own and the check aborted fuzz-smoke and fuzz-alloc before any test ran. Getting the check past that turned up three more bugs the dead gate had been hiding.th_tag_keyloads an 8-byte word of the tag name. The tokenizer counted on the growth policy's 16-byte first allocation, but the fuzz build starts every buffer at two bytes. The tokenizer now reserves the word itself, which leaves release builds at 16 bytes.select_cache_finishformedNULL + 0(undefined behavior) when the first select cache allocation failed. It now walks the caches by index.url_percent_encode_slowreturned NULL without an exception when its buffer allocation failed, so link resolution raisedSystemErrorinstead ofMemoryError.A failing self-check now also names the report kind that fired instead, without the stack, which would publish an unfixed bug's location.
Verified in an ubuntu 24.04 container with clang 18 and compiler-rt, the toolchain of the workflow's runner. Combined with #2544, which fixes the 11
test_self_test.pyfailures the dead gate also hid,tox -e fuzz-smokepasses its self-check and all 164 fuzz-build tests, andtox -e fuzz-allocsweeps every seed clean under both allocators. The regression coverage is those gates: the self-check, theparse-selectedcontentallocation sweep and the url allocation sweep each fail without the matching fix.