feat(libfreetype): implement FT_Gzip_Uncompress #15439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15439"
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 VakzOs on 2026-11-03T09:57:57Z.
What
The legacy
libfreetypeexporthKvvpNeUdKothrew. The verified NID name database names itFT_Gzip_Uncompress, andtools/nid_names.pycomputes the same NID for that name. It is now implemented asFT_Gzip_Uncompress_nid_postfixinsrc/Gzip.cpp.The call goes to the bundled FreeType 2.15.0
FT_Gzip_Uncompress, built with its internal zlib (FT_DISABLE_ZLIBonly turns off the system zlib). A hostFT_MemoryRecroutes zlib's allocations to the guestFT_MemoryRec'salloc,freeandrealloc, reusingFreeType::GuestMemoryRecfrom libSceFreeType. Lengths cross as the console's 64-bitFT_ULong. On Windows, whereFT_ULongis 32-bit, a length aboveULONG_MAXreturnsInvalid_Argumentbefore any cast. The output length is written back only on success, as FreeType does. The results are therefore FreeType's own:Invalid_Argumentfor a null memory, output or length, and wheninflateInit2fails;Array_Too_Largewhen the output is too small;Invalid_Tablefor corrupt data;Out_Of_Memorywheninflatecannot allocate.libfreetypegains aCMakeLists.txtthat linksfreetypewith--exclude-libs,ALL, as libSceFreeTypeOt does. The patched module exportshKvvpNeUdKoand noFT_*symbols.The console's FreeType version and build options are unverified: a console FreeType built without zlib would return
Unimplemented_Feature.docs/dev/debt/libfreetype.mdrecords this.Tested
Linux, GCC 13, Release: the new
guest_legacy_freetype_gzippasses. It decodes a gzip stream and a zlib stream through guest memory callbacks, checks the text and length, and checks that every guest allocation is freed. It also covers the null-argument, short-output, corrupt-data and failed-inflateInit2results, with the output length left unchanged on failure. Whereunsigned longis 32-bit (the Windows CI job), it also checks both lengths atULONG_MAX + 1.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --branchreports one overlap, #15408 (libfreetype font metadata). Both PRs addcore/libs/prx/libfreetype/CMakeLists.txtand touch adjacent lines inlibfreetype.hppand the debt file; no export is shared. I propose #15408 lands first and I rebase this onto it, addingsrc/Gzip.cppand the test to itsCMakeLists.txt.Not tested on hardware or with a title.
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)