Repository navigation
fix(libc): reject null secure scan destinations - #7211
Merged
oneandonlydean merged 1 commit intoOct 17, 2026
Merged
Conversation
Prevent reached null conversion destinations from crashing sscanf_s and vsscanf_s. Return EOF before writes and retain earlier assignments. Add regression coverage through both guest ABI entry points. AI-assisted: yes (OpenAI Codex). Windows WinLibs GCC 15.2 Release: production baseline crashes with the new regression; fixed shared libc passes guest_scan_count, guest_formatting, guest_wide_formatting and guest_strings (4/4). Conventions pass. Full all-target build was deliberately stopped after 83s with 3691 pending targets, not completed. No title or console run; constraint-handler invocation remains unimplemented as documented. No performance or coverage-percentage claim.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
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.
What
sscanf_s("7", "%d", nullptr)writes through address zero and crashes inside the Windows sharedlibc.prx. The shared scanner also dereferences a null%ndestination directly. Both paths affectsscanf_sandvsscanf_s.Check a reached destination before writing or passing it to the host scanner. Return
EOF, retain earlier successful assignments and stop before later conversions. C11 N1570, K.3.5.3.7 and K.3.5.3.14, specify the null-destination constraint andEOFresult. Existing constraint-handler invocation remains unimplemented; console behavior is unverified, as recorded in libc debt.The regression adds 20 calls across both guest ABI entry points: integer, real, string, character, scanset and count destinations; a null after an earlier assignment; no later writes; matching failure before an unreachable null; and assignment suppression. This is a synthetic crash correction: no known title is claimed to reach this path, and no implementation-percentage or performance gain is claimed.
Tested
Windows, WinLibs MinGW-w64 GCC 15.2.0r7 UCRT, Release, actual shared libc and CMake test targets, based on
66702f1cffd3646f2d674ed093fde0a85a70761f:guest_scan_countcrashes with0xc0000005, writing address zero; the other three tests pass.2a2e9e9357e8636fbf90ffe748d2d277445a7fcc:guest_scan_count,guest_formatting,guest_wide_formatting,guest_stringspass (4/4, 0.69 s).tools/check_conventions.py --base 66702f1cffd3646f2d674ed093fde0a85a70761fandgit diff --checkpass.tools/pr_overlap.pycannot run here becauseghis unavailable; live connector searches found no open null-destination fix. feat(libc): scan 16-bit wide conversions in sscanf and vsscanf on Linux #6731 and feat(libc): scan 16-bit wide conversions in fscanf on Linux #6732 change the same scanner for wide conversions and may require reconciliation if merged first; this fix does not depend on their functionality.AI assistance: OpenAI Codex. Evidence logs are attached below.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)secure-scan-null-evidence-20261017.zip