WTF::Internal::parseDoubleFromLongString read the caller's UTF-16 units
and wrote the parsed length through guest pointers, so an unmapped
string or output crashed the host. The units are now copied in with
GuestCopyIn_nid_no_patch, 2048 at a time through a 4 KiB stack chunk
into the existing narrow buffer, so no second buffer is sized from the
caller's length, and the parsed length is written with one
GuestCopyOut_nid_no_patch. A string that can't be read or an output
that can't be written throws std::invalid_argument.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both StringView::getCharactersWithASCIICase overloads read the guest
StringView and its characters directly and wrote the guest output
buffer element by element. equalIgnoringNullity(const UChar*, size_t,
StringImpl*) read the guest character buffer directly.
They now copy the StringView in with GuestCopyIn_nid_no_patch and walk
the characters in fixed chunks of 2048 code units: each chunk is copied
into a host array, converted or compared there, and the case-converted
chunk is written back with one GuestCopyOut_nid_no_patch. No host
buffer is sized from the guest length, so an oversized length with a
short guest buffer fails at the first unreadable chunk.
An unreadable StringView, character buffer or unwritable output throws
std::invalid_argument, like the other WtfString.cpp argument checks
and the merged FourCC::fromString guest copy; the GuestCopy helpers
keep errno. Results for readable inputs are unchanged. The StringImpl
argument is allocated by the library and stays a host object.
String(const char*), String::fromUTF8(const LChar*), equal(StringImpl*,
const LChar*) and CString(const char*) ran strlen over the guest C
string. They now copy it into a host string in page-bounded chunks of
at most 4096 bytes with GuestCopyIn_nid_no_patch until the terminator,
and work on the copy. An unreadable string throws
std::invalid_argument, keeps errno and leaves the destination object
unchanged. The C2 constructors call the C1 ones.
Both overloads are declared to return Expected<CString,
UTF8ConversionError>: 16 bytes written through the hidden result
pointer, the CString or the error first and the has flag at offset 8.
The port returned a bare CString, so the flag a caller tests was never
written, and it threw on a strict-mode failure where WebKit returns the
error.
They now write the whole object: IllegalSource for an unpaired surrogate
in strict mode, SourceExhausted for a lead surrogate that ends the
buffer, OutOfMemory above MaxLength / 3 characters.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The lenient mode of StringImpl::utf8, String::utf8, StringView::utf8 and
utf8ForCharacters encoded every unpaired surrogate as three bytes.
WebKit's convertUTF16ToUTF8 replaces an unpaired surrogate with U+FFFD
when it is not strict, and only a lead surrogate that ends the buffer
reaches the three-byte encoding, through the SourceExhausted branch of
utf8Impl. Do the same.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
WTF::Internal::parseDoubleFromLongString went through the host's
strtod, which skips leading white space, reads hexadecimal, "inf" and
"nan", and follows the host's numeric locale. WebKit narrows the text
and calls StringToDoubleConverter::StringToDouble, which accepts none
of those, and this library already exports that converter. Call it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* feat(libSceNKWebKit): implement WebCore unionRect, exposed tile edges, presentingApplicationPID, SVG legacy feature test and autofill field names
* docs(libSceNKWebKit): carry the upstream WebKit notices on the ported helpers
* chore(libSceNKWebKit): give each Derived from line its path and full revision
* docs(libSceNKWebKit): keep one callable export count line after the merge of main
* docs(libSceNKWebKit): drop duplicate export count line after merge
Co-authored-by: pr-review2 <pr-review2@users.noreply.github.com>
Co-authored-by: Dean Galvin <dean.galvin@live.com>
Both follow WebKit URLParser.cpp at 3539f609da3d over the URL layout the
other WTF::URL exports already decode: allValuesEqual compares the string
and every field, internalValuesConsistent checks the offset ordering with
the scheme end in bits 6-31 and the port length in bits 3-5. Null URL
references throw, as the other URL exports do.
Ports the 27 StringBuilder and TextStream exports that still threw from
public WebKit c55364d53f97: appendCharacters, reserveCapacity,
shrinkToFit, reifyString, appendNumber(float) and appendQuotedJSONString,
the TextStream operators, release, groups and indent, and the Seconds and
URL operators. Both layouts are pinned with static_assert from the
release headers of that revision; they are not checked against a console
binary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace 1137 NotImplemented stubs with implementations that follow the PS5 11.x OSS WebKit source: the API object model and value types, WKPreferences with PlayStation defaults, context, page, website data store and user script configuration objects, the JS* API on QuickJS-NG with libSceJsc strings, WebCore geometry, transform and color values, and WTF allocation, time, string and URL value operations. Exports whose behaviour needs the WebKit engine, the WebCore URL parser or unproven layouts stay stubs; the gaps are in docs/dev/debt/libSceNKWebKit.md.
Every export is declared once in headers reachable from the library umbrella. Allocation size, alignment and header overhead are computed with overflow checks and the try variants return null at the boundaries. tryFastMalloc, tryFastZeroedMalloc, tryFastCalloc and tryFastRealloc return WTF::TryMallocReturnValue, which is returned in memory, so they take the caller's result pointer first, store the allocation through it and return it.
The libSceJsc string exports that libSceNKWebKit calls are named with the _nid_postfix suffix, so the NID patcher renames those imports along with the exports and the patched libSceNKWebKit.prx resolves them on Linux; their NIDs are unchanged.