libc: track reported wide scanf incomplete-field and literal-EOF differences #9321
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-21T18:23:37Z.
Three differences reported in merged #8479 remain reproducible in the shared wide scanner on current main
b00235dda0bdf5101c6af181416e57529e5fa2ba.These are independently reproduced Windows implementation results, compared with the original author's reported firmware differential evidence. I have not run these cases on a PS5 or loaded a firmware module. This issue tracks the remaining behavior and evidence needed for a focused fix; it does not claim independently verified PS5 regressions.
1e+,%lf, destination initialized to-99-99, input is consumed through EOFa,%3lc, destination filled with0xa55a%cfieldxEOF(-1)The original author's Remaining differences section explicitly says the buffer scanner has the same differences. The exact return count, partial-output extent, and precedence for each surrounding format should be confirmed before changing behavior, particularly after earlier assignments, suppressed fields, width limits and secure-capacity failures. The author describes a module/scanner harness; this should not be conflated with executing a title or these particular cases on hardware.
Reproduced through patched NID exports for all eight stream forms:
fwscanfa6CYO8YOzfwfwscanf_sBo5wtXSj4kcvfwscanfWF4fBmip+38vfwscanf_sWvm90I-TGl0wscanfD8JBAR3RiZQwscanf_sRV7X3FrWfTIvwscanfQNwdOK7HfJUvwscanf_sYgZ6qvFH3QIMinimal equivalent diagnostics can be inserted into
core/libs/tests/GuestWideStreamScan.cpp, using its existingOpenandClosefixture and declarations:Own validation: Windows x86-64, WinLibs GCC 15.2 Release, isolated checkout. A separate native probe loaded the actual patched
libc.prxand printed all three diagnostics through each of the eight forms; results were identical across ten runs. It also passed 8,882 current-model checks per run for integer argument registers/stack, guest store widths,%ln, suppression, secure capacities, canaries, stdin routing, null arguments and ASCII lookahead. The count includes repeated identical cases, not 8,882 unique firmware behaviors. The five existing suitesguest_wide_stream_scan,guest_wide_conversion,guest_stdio_variadic,guest_wide_stringsandguest_scan_countpass. These passing checks do not validate the three reported firmware expectations. No games, console runs or proprietary artifacts.Scope/overlap: #8306 owns
%S/%Cmatching failures in the sameWideScanner; these three cases are separate but touch shared scanner/debt code, so coordinate ordering. #7386 handles 16-bit wide fields in the narrow scanf family on Linux. #8897 concerns wide stream encoding and remains separate. The current non-ASCII pushback limitation, locale behavior and atomic stream locking were not independently validated by this ASCII probe. No competing fix for these three cases was found in the current all-state searches; search results alone are not proof of absence.There is no behavior fix in this report. A follow-up should first pin the expected edge cases with attributable evidence, add failing regressions, and compare identical baseline/candidate tests. AI-assisted investigation and report; I am responsible for the results stated here.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T18:36:50Z.
For the short
%3lccase in #9321, could you share the observed firmware return value, exactly which destination elements are written, and whether any input remains? If the differential harness also covered_s, suppressed fields, or a prior assignment, those results would help pin the general rule. I have left that case out of the current patch until its contract is clear.Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-22T03:16:25Z.
I cannot supply a measured firmware return count or partial-write extent for
%3lc: I did not run the console scanner. The firmware expectation in this report is attributed to the original author's Remaining differences in #8479, rather than an independent measurement by me.My Windows observation for input
a/%3lcwas return 0, destination still filled with0xa55a, and input consumed to EOF, including the secure stream form shown in the reproducer. That is the current implementation result, not the expected firmware contract. I have no firmware measurements for suppressed fields, prior assignments or secure-capacity precedence.#9331 correctly leaves this case out and addresses the other two reported differences separately. Before adding a short-field behavior regression, the remaining evidence needed is the exact return count, written code units and guards, input position, and the same observations for
_s, suppression and prior assignments. A source-only reproducer with summarized observations would establish that without publishing a firmware module. This issue should remain open for that case.Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T13:40:59Z.
@MarcZX10 here is the firmware contract for #9321. I'm the author of #8479. I measured these just now by loading PPSA03671's
libc.prx(build J03848509) into a Linux process and calling itsswscanf(0x73dc0) andswscanf_s(0x7bcc0) directly. Destinations were pre-filled with0xa55a;%nshows how much input was consumed.%na%3lc0061 a55a a55a a55a: only element 0 writtenab%3lc0061 0062 a55a a55aabc%3lc0061 0062 0063 a55aa%3lc,swscanf_swith size 40061 a55a a55a a55aa%*3lc5 a%d %3lck=5,0061 a55a a55a a55aa%3lc%n0061 …,n=11e+%lf11e+%lf%n1,n=31e+x%lf10x1p-%lf1xx" "x%%5%dxk=5So:
%Nlc: a short field stores what it read, writes nothing past it, and counts as an assignment. The_sform, a suppressed field, a prior assignment and%nbehave consistently with that.1e+and0x1p-convert the mantissa and consume the exponent marker and sign.%%at EOF returnsEOF.The stream scanner gave the same results in my #8479 runs. I didn't repeat those today. This is the title's bundled
libc.prxrun natively, not a run on a console.Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-22T14:20:25Z.
The new results settle the expected outcomes for these cases in the bundled library/build you identified. I have recorded them as contributor-reported native execution of that bundled
libc.prx, rather than a console run or proof across firmware versions. Current source still rejects a short%Nlcfield and an incomplete floating exponent, so this issue remains actionable. #8479 is already merged and explicitly left these shared-scanner differences for follow-up; I will keep the remaining contract/regression work here instead of opening a duplicate issue. The short-field bounds, consumed%n, suppressed/secure forms, and literal-versus-%%EOF distinction all need to stay separate in that follow-up.