Console libSceLibcInternal exports o4kt51-uO48 as a 104-byte STT_OBJECT;
titles that resolve the symbol as data need a zeroed 13-slot vtable like the
other facet vtables, not a missing import.
Implement iswascii in libc, checking whether a wide character falls within the 7-bit ASCII range (0x00 to 0x7F). Add unit test coverage in GuestRuneLocale.
The heap error report threw FileStream: closed stream out of the export when the guest had closed its standard output, so a heap-error diagnostic aborted through the exception instead of reporting. The standard output part is now skipped when the stream is closed; the host diagnostic on the host stderr is still written.
log1p returned the host's log1p, whose last bit differs from the titles'
copy on Windows on 24,477,433 of 320 million random arguments. The titles'
copy is FreeBSD msun's s_log1p.c, and it sets EDOM at msun's NaN return,
for arguments below -1, -inf and negative NaNs, but not for log1p(-1).
log1p now computes that algorithm and sets EDOM there.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The write threw inside GetNativeStream, which the wide writers catch and
report as EINVAL. fputc, fputs and vfwprintf fail a closed stream with
errno 9; putwc and putwchar go through fputwc.
ungetwc on a stream that a failed freopen closed reached GetHandle() and threw
out of the export. ungetc and the other narrow stream calls return failure
with errno 9.
A traced run that ends without a crash or an abort never reports which
imports it called. With APS5_TRACE_CALLS_FILE set, the first traced import
starts a thread that rewrites that file every 10 seconds with every import
called so far, most called first.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
vfscanf, which vscanf and scanf also go through, read without switching
the stream to reading first. On Windows a vfscanf directly after fwrite
on an r+ stream returned bytes of the write buffer, as fscanf did before
a7e6e597d. It now calls SwitchToReading as fscanf does.
GuestCopyOut_nid_no_patch fell back to memcpy when process_vm_writev failed
with anything but EFAULT, and on every non-Linux/non-Windows host. Throw
instead (macOS uses mach_vm_write as Udp.cpp does) and cover read-only and
PROT_NONE pages plus a seccomp EPERM child in guest_fstat_fault.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fstat, _fstat, sceKernelFstat, stat, lstat, sceKernelStat and _fstatfs
filled the caller's struct in place, or copied into it after a check that
only tests for null, so a pointer into unmapped memory crashed the host.
Fill a local struct and copy it out with a checked write that fails with
EFAULT. FreeBSD 11.4 does the same after the lookup has succeeded:
copyout(&ub, uap->sb) in sys_fstat (sys/kern/kern_descrip.c:1328),
copyout(&sb, uap->ub) in sys_stat (sys/kern/vfs_syscalls.c:2066) and
copyout(sfp, uap->buf) in sys_fstatfs (sys/kern/vfs_syscalls.c:337).
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The printf family formatted floating-point conversions through the host,
which prints every exact digit and rounds ties to even. The libc.prx
that titles ship keeps the exact digits only down to a position derived
from the binary exponent and prints zeros after them, rounds half up on
the kept digits, and rounds an exact tie down once that exponent
estimate reaches 8. So %.0f of 2.5 is 3 and %.1f of 0.25 is 0.3 there,
and %.20f of 0.1 is 0.10000000000000000555.
Format finite double and long double e, f and g conversions with those
rules from exactly generated digits, on every host. On 600,000 random
formats every output with up to 17 significant digits now matches the
copies bundled with PPSA07923, PPSA05916 and PPSA13934; longer outputs
still differ where the console's extended-precision digits end one unit
lower.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Linux handed a format without wide arguments, %m or %p to glibc, so %a
there still printed subnormals unnormalised and rounded hexadecimal
digits half to even, and CheckHexFloat, which runs on every host,
failed on Linux. Route %a and %A to FormatWindows on Linux as well.
Co-Authored-By: Claude Opus 5.5 <[email protected]>