Repository navigation
fix(libc): report fopen_s and freopen_s argument errors to the constraint handler - #12597
Conversation
…aint handler
The libc.prx that titles ship (PPSA07923, PPSA05916) calls the
constraint handler with EINVAL and a null pointer when fopen_s or
freopen_s gets a null FILE ** ("fopen_s: bad FILE ** argument") or a
null filename, mode or stream ("fopen_s: bad argument"); freopen_s
reports the fopen_s messages too. main returned EINVAL without the
call. Return values and the stored stream are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@JJenkx the code matches your description and the tests check each message; one leftover to fix:
|
|
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.
|
Both debt entries still said the constraint handler is not invoked. They now give the measured messages and note that the null-name freopen_s case keeps ENOTSUP without a handler call. Pointed out by oneandonlydean in review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean thanks, fixed in
Conventions pass. AI-assisted: yes (Claude Code). |
|
Integrated upstream main Linux CPU: 9 passes (guest_fiopen, guest_fopen_errors, guest_crt); public_headers 1 passes; no skips. MinGW source syntax and conventions pass. No new Windows/macOS runtime, native SDK, game, GPU or performance claim. The Windows user pause remains in force. Evidence: immutable source and qualification receipts, SHA-256 AI-assisted: yes. |
|
A Windows run with GCC 16: Windows 11 Pro 10.0.22631, i9-9900K, MSYS2 UCRT64 GCC 16.1.0, Release, this PR (
AI-assisted: yes (Claude Code) |
What
fopen_sandfreopen_snow report argument errors to the constraint handler, as titles'libc.prxdoes. The handler getsEINVALand a null pointer, with these messages:FILE **"fopen_s: bad FILE ** argument"fopen_s), null mode, or null stream (freopen_s)"fopen_s: bad argument"freopen_sreally does report thefopen_smessages. Onmainboth returnedEINVALwithout calling the handler. The return values and the stored stream (left alone for a nullFILE **, set to null otherwise) were already right and are unchanged. Other errors, such as an invalid mode or a missing file, are not changed here.Depends on #9935. On
mainthe default constraint handler aborts, so until #9935 merges, a title that hits one of these violations without installing a handler would abort. Merges cleanly with #9935, #10755 and #11831.Tested
Windows 11, WinLibs GCC 15.2.0 UCRT r7, Release,
main319621ba2e.fopen_sandfreopen_s(including all null), plusgets_swith size 0, size2^61and a null buffer. Each case compares the return value, the stored stream, and the handler's calls, error, pointer and message.main: the 9fopen_s/freopen_scases differ, and the 3gets_scases already match.guest_fiopenandguest_fopen_errorsinstall a recording handler around these cases and check each message. With the previousFileAndHeap.cppboth fail.guest_fiopen,guest_fopen_errors,guest_safe_errors,guest_bounds_checkingandguest_crtpass 3/3. Conventions pass.Current qualification — 2026-10-30
Integrated upstream main
08a10d225306ad102b57408e2ef7566bcfb829b2at1768c1821b2921745f051fb97b999bb63b97f38f, retaining the actual previous head and main as parents. Manual conflict resolution changes only debt documentation; production and test files equal the automatic merge output. Both parents' added test lines and main gitlinks are preserved.Linux CPU: 9 passes (guest_fiopen, guest_fopen_errors, guest_crt); public_headers 1 passes; no skips. MinGW source syntax and conventions pass.
No new Windows/macOS runtime, native SDK, game, GPU or performance claim. The Windows user pause remains in force.
Evidence: immutable source and qualification receipts, SHA-256
61f5500e7526ea4e107159927de78c37db7e0ac1cb7ebd8625b22ab0ad5d9bd7(download verified).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)🤖 Generated with Claude Code