feat(libharfbuzz): implement buffer exports with a pinned backend #14441

Merged
bipinkrish merged 2 commits from upstream-pr/14441 into main 2026-11-06 22:29:45 +00:00
bipinkrish commented 2026-11-01 13:45:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by bipinkrish on 2026-11-01T13:45:35Z.


What

Implement the eleven declared hb_buffer_* exports using a static HarfBuzz 10.0.1 backend pinned as 3rdparty/harfbuzz (a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc). This covers buffer creation/destruction, UTF-16 ingestion, length, direction/script settings, segment-property guessing, glyph info/position access, and reset. The other 24 exports still throw. The project scanner counts 2/35 as fully implemented and the other 9 buffer functions as partial because their unverified null-handle paths throw; all eleven implement their public API behavior for valid handles.

The adapter uses System V guest calls, checks the public glyph-record layout, and brackets caller-supplied output lengths with GuestArena::HostWrite. The backend is built from source with CMake, its symbols stay local, and its HarfBuzz and Microsoft USE notices are installed and included in both patched and unpatched ZIP/tar release archives. Guest symbols use _nid_postfix to avoid colliding with the backend while retaining their existing NIDs. Public headers do not include third-party headers.

Signatures and behavior follow the pinned public buffer API and implementation, not console measurements. The unknown console revision/Unicode tables, host default language and opaque host handles are recorded in docs/dev/debt/libharfbuzz.md. Null handles other than destruction throw because console behavior is unverified. No test asserts or pins NotImplemented_nid_no_patch paths.

Tested

Ubuntu 24.04, Linux x86-64, GCC 13.3.0. Full project configured with Ninja, BUILD_TESTING=ON; the already unpacked upstream FFmpeg package was supplied through FFMPEG_PREBUILT_DIR.

  • Release integrated build: cmake --build /tmp/anyps5-harfbuzz-build --target guest_harfbuzz_buffer_tests --parallel 4 passed.
  • ctest --test-dir /tmp/anyps5-harfbuzz-build -R '^guest_harfbuzz_buffer_' --output-on-failure: 3/3 passed. The tests compare guest calls with separate native buffers from the pinned backend, with golden decoding/cluster and direction cases: all 65,536 UTF-16 units, surrogate boundaries, embedded NULs, substring offsets/lengths, 1,000 deterministic randomized cases, eight scripts, explicit property preservation, independent buffers, array lifetime/mutation and reset/reuse.
  • Debug build with ANYPS5_ENABLE_ASAN=ON: the same 3 tests passed with ASAN_OPTIONS=detect_leaks=1. LeakSanitizer required execution outside the sandbox.
  • ctest --test-dir /tmp/anyps5-harfbuzz-build -R '^public_headers' --output-on-failure -j 4: 65/65 passed.
  • A functional smoke test loaded the NID-patched libharfbuzz with matching patched libc/libkernel and called all 11 exports through their NIDs: UTF-16 codepoints/clusters, zeroed/mutable positions, script/direction guessing and reset passed.
  • License packaging: python3 tools/tests/test_package_release.py ran 80 tests successfully (5 platform-specific skips). New tests check both upstream notices in patched/unpatched ZIP and tar archives and reject missing notices before publishing output. CMake installation of both notices was verified against their original bytes.
  • Adapter and test source passed -Wall -Wextra -Werror -fsyntax-only; git diff --check passed.
  • python3 tools/check_conventions.py --base origin/main: passed with 0 errors and 8 warnings in unrelated upstream libkernel/libSceVisionManager debt entries. Against upstream/main: all checks passed on the final commit.

Not tested: Windows, macOS, games, homebrew or PS5 hardware. The full all-libraries/package build was not completed; the integrated library/test target and direct NID patching were verified.

Overlap check: python3 tools/pr_overlap.py --branch codex/harfbuzz-buffers --repo boykopovar/AnyPS5 --jobs 8 checked 1,670 open PRs and found no verified conflicts or shared exports after the HarfBuzz submodule entry was placed next to FreeType. It exited 2 because stale #1835, #5021, #9855 and #13578 cannot merge into the base and share .gitmodules. Each was manually compared: #1835/#5021 add Capstone, pyelftools and ps5link-sdk; #9855 adds jemalloc; #13578 adds ICU. None adds HarfBuzz or changes its exports, and their submodule edits are separate from this entry. No functional dependency.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5107920745 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14441). Originally posted by [bipinkrish](https://github.com/bipinkrish) on 2026-11-01T13:45:35Z. --- ### What Implement the eleven declared `hb_buffer_*` exports using a static HarfBuzz 10.0.1 backend pinned as `3rdparty/harfbuzz` (`a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc`). This covers buffer creation/destruction, UTF-16 ingestion, length, direction/script settings, segment-property guessing, glyph info/position access, and reset. The other 24 exports still throw. The project scanner counts 2/35 as fully implemented and the other 9 buffer functions as partial because their unverified null-handle paths throw; all eleven implement their public API behavior for valid handles. The adapter uses System V guest calls, checks the public glyph-record layout, and brackets caller-supplied output lengths with `GuestArena::HostWrite`. The backend is built from source with CMake, its symbols stay local, and its HarfBuzz and Microsoft USE notices are installed and included in both patched and unpatched ZIP/tar release archives. Guest symbols use `_nid_postfix` to avoid colliding with the backend while retaining their existing NIDs. Public headers do not include third-party headers. Signatures and behavior follow the pinned [public buffer API and implementation](https://github.com/harfbuzz/harfbuzz/blob/a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc/src/hb-buffer.cc), not console measurements. The unknown console revision/Unicode tables, host default language and opaque host handles are recorded in `docs/dev/debt/libharfbuzz.md`. Null handles other than destruction throw because console behavior is unverified. No test asserts or pins `NotImplemented_nid_no_patch` paths. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Ubuntu 24.04, Linux x86-64, GCC 13.3.0. Full project configured with Ninja, `BUILD_TESTING=ON`; the already unpacked upstream FFmpeg package was supplied through `FFMPEG_PREBUILT_DIR`. - Release integrated build: `cmake --build /tmp/anyps5-harfbuzz-build --target guest_harfbuzz_buffer_tests --parallel 4` passed. - `ctest --test-dir /tmp/anyps5-harfbuzz-build -R '^guest_harfbuzz_buffer_' --output-on-failure`: 3/3 passed. The tests compare guest calls with separate native buffers from the pinned backend, with golden decoding/cluster and direction cases: all 65,536 UTF-16 units, surrogate boundaries, embedded NULs, substring offsets/lengths, 1,000 deterministic randomized cases, eight scripts, explicit property preservation, independent buffers, array lifetime/mutation and reset/reuse. - Debug build with `ANYPS5_ENABLE_ASAN=ON`: the same 3 tests passed with `ASAN_OPTIONS=detect_leaks=1`. LeakSanitizer required execution outside the sandbox. - `ctest --test-dir /tmp/anyps5-harfbuzz-build -R '^public_headers' --output-on-failure -j 4`: 65/65 passed. - A functional smoke test loaded the NID-patched libharfbuzz with matching patched libc/libkernel and called all 11 exports through their NIDs: UTF-16 codepoints/clusters, zeroed/mutable positions, script/direction guessing and reset passed. - License packaging: `python3 tools/tests/test_package_release.py` ran 80 tests successfully (5 platform-specific skips). New tests check both upstream notices in patched/unpatched ZIP and tar archives and reject missing notices before publishing output. CMake installation of both notices was verified against their original bytes. - Adapter and test source passed `-Wall -Wextra -Werror -fsyntax-only`; `git diff --check` passed. - `python3 tools/check_conventions.py --base origin/main`: passed with 0 errors and 8 warnings in unrelated upstream libkernel/libSceVisionManager debt entries. Against `upstream/main`: all checks passed on the final commit. Not tested: Windows, macOS, games, homebrew or PS5 hardware. The full all-libraries/package build was not completed; the integrated library/test target and direct NID patching were verified. Overlap check: `python3 tools/pr_overlap.py --branch codex/harfbuzz-buffers --repo boykopovar/AnyPS5 --jobs 8` checked 1,670 open PRs and found no verified conflicts or shared exports after the HarfBuzz submodule entry was placed next to FreeType. It exited 2 because stale #1835, #5021, #9855 and #13578 cannot merge into the base and share `.gitmodules`. Each was manually compared: #1835/#5021 add Capstone, pyelftools and ps5link-sdk; #9855 adds jemalloc; #13578 adds ICU. None adds HarfBuzz or changes its exports, and their submodule edits are separate from this entry. No functional dependency. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-01 13:58:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T13:58:14Z.

Review: COMMENTED


Reviewed — no blocking findings

The eleven buffer adapters match the pinned HarfBuzz buffer API they call, the renamed _nid_postfix exports keep the NIDs of the names they replace, and the new HarfBuzz notices are packaged and checked; hosted checks at this head are still queued, so this is a COMMENTED result, not an approval.

What I ran

  • Exact head 821d724d41c28b97110e417500a6b8de167422d6, base f1a7b02028 (the PR base). The head moved from d8a7e2cdff during this review; d8a7e2cdff is the head I first triaged and it is not posted. The one new commit, "fix(release): include HarfBuzz redistribution notices", adds the notices to tools/package_release.py, a CMake install line and two tests.
  • Environment: Linux, /usr/bin/python3 3.11.2, no build.
  • Precheck at the new head: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14441 --output-dir /dev/shm/reviewer-run/precheck/14441
  • ABI audit by hand (the helper is absent from the head tree): python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f1a7b02028 --head 821d724d41c28b97110e417500a6b8de167422d6 --json (exit 0; passed_with_warnings; 70 findings, all of kind definition-not-found or export-removed for renamed names). I also compared computed NIDs of each old name and its _nid_postfix name: all 35 pairs are equal.
  • Test-quality helper by hand on core/libs/tests/GuestHarfBuzzBuffer.cpp and tools/tests/test_package_release.py from a head extract: the first reports one literal-path registration heuristic (the test is registered in core/libs/prx/libharfbuzz/CMakeLists.txt); the second reports nothing.
  • Pinned submodule checked with gh api: src/ms-use/COPYING (1141 bytes) and the root COPYING (1971 bytes) exist at a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc, the paths the install line and the packaging use.
  • Source read at head: Buffer.cpp in full, the Export.cpp and InventoryExports.hpp changes, and GuestHarfBuzzBuffer.cpp (the Utf16, Properties and Lifetime functions).

Results

Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14441/report.md):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check f1a7b02028ae50adaf6c5aaaef892a51841b25bf...821d724d41c28b97110e417500a6b8de167422d6
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base f1a7b02028ae50adaf6c5aaaef892a51841b25bf --head 821d724d41c28b97110e417500a6b8de167422d6 --title feat(libharfbuzz): implement buffer exports with a pinned backend --body /dev/shm/reviewer-run/precheck/14441/pr-body.md
changed_export_abi_audit failed /usr/bin/python3 tools/pr_abi_audit.py --base f1a7b02028ae50adaf6c5aaaef892a51841b25bf --head 821d724d41c28b97110e417500a6b8de167422d6 --json
python_syntax passed /usr/bin/python3 -m py_compile tools/package_release.py
unit:tools/tests/test_package_release.py passed /usr/bin/python3 -m unittest tools.tests.test_package_release
python_test_registration passed /usr/bin/python3 tools/check_test_registration.py --scripts
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14441 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14441/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /usr/bin/python3 /dev/shm/reviewer-run/precheck/14441/head-821d724d41c2-ad2dff4c/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14441/head-821d724d41c2-ad2dff4c --json .gitmodules 3rdparty/harfbuzz core/libs/prx/libharfbuzz/Buffer.cpp core/libs/prx/libharfbuzz/CMakeLists.txt core/libs/prx/libharfbuzz/Export.cpp core/libs/prx/libharfbuzz/include/InventoryExports.hpp core/libs/tests/GuestHarfBuzzBuffer.cpp docs/dev/debt/libharfbuzz.md tools/package_release.py tools/tests/test_package_release.py
negative_controls failed A pass means every candidate failed by assertion on base; a failure means at least one did not discriminate or could not run. See per-test results.

Negative control

The precheck's negative control runs the release test file against base. On base the new HarfBuzz tests fail (two F and one E), and the precheck reports not_executable; the failures are assertions and a missing-exception check, so the new tests discriminate the change.

Findings

Blocking: none.

Non-blocking:

  • The ABI audit's 70 lexical findings are all the rename class: the old names are gone and their _nid_postfix names are defined. The NID check above confirms that the renamed symbols keep the same computed NIDs, which is the point of the convention. The audit still cannot prove the NID encoding, so that rests on the repository's _nid_postfix convention.
  • GuestHarfBuzzBuffer.cpp checks the adapter against the same HarfBuzz backend it links, so it tests the adapter's argument and layout handling, not HarfBuzz's own shaping or Unicode rules. The expected code points and clusters for the UTF-16 case are hard-coded and I checked them by hand.
  • Twenty-four exports still throw through NotImplemented_nid_no_patch, as the PR states; the debt file records them.

Sources

Not verified

  • No build: the adapter, the backend and both guest tests were not compiled or run; the static_assert layout checks were not compiled.
  • Windows and macOS paths of the static backend build, the --exclude-libs link option and the install rules were not run.
  • The NID encoding is verified only through the audit's computed values, not through a runtime lookup.
  • Hosted: at review time conventions, eligibility, library-portability and report were queued at this head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728398681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14441#pullrequestreview-5728398681). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T13:58:14Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The eleven buffer adapters match the pinned HarfBuzz buffer API they call, the renamed `_nid_postfix` exports keep the NIDs of the names they replace, and the new HarfBuzz notices are packaged and checked; hosted checks at this head are still queued, so this is a COMMENTED result, not an approval. ## What I ran - Exact head `821d724d41c28b97110e417500a6b8de167422d6`, base `f1a7b02028` (the PR base). The head moved from `d8a7e2cdff` during this review; `d8a7e2cdff` is the head I first triaged and it is not posted. The one new commit, "fix(release): include HarfBuzz redistribution notices", adds the notices to `tools/package_release.py`, a CMake install line and two tests. - Environment: Linux, `/usr/bin/python3` 3.11.2, no build. - Precheck at the new head: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14441 --output-dir /dev/shm/reviewer-run/precheck/14441` - ABI audit by hand (the helper is absent from the head tree): `python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base f1a7b02028 --head 821d724d41c28b97110e417500a6b8de167422d6 --json` (exit 0; `passed_with_warnings`; 70 findings, all of kind `definition-not-found` or `export-removed` for renamed names). I also compared computed NIDs of each old name and its `_nid_postfix` name: all 35 pairs are equal. - Test-quality helper by hand on `core/libs/tests/GuestHarfBuzzBuffer.cpp` and `tools/tests/test_package_release.py` from a head extract: the first reports one literal-path registration heuristic (the test is registered in `core/libs/prx/libharfbuzz/CMakeLists.txt`); the second reports nothing. - Pinned submodule checked with `gh api`: `src/ms-use/COPYING` (1141 bytes) and the root `COPYING` (1971 bytes) exist at `a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc`, the paths the install line and the packaging use. - Source read at head: `Buffer.cpp` in full, the `Export.cpp` and `InventoryExports.hpp` changes, and `GuestHarfBuzzBuffer.cpp` (the `Utf16`, `Properties` and `Lifetime` functions). ## Results Precheck report, checks table, unedited (`/dev/shm/reviewer-run/precheck/14441/report.md`): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check f1a7b02028ae50adaf6c5aaaef892a51841b25bf...821d724d41c28b97110e417500a6b8de167422d6` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base f1a7b02028ae50adaf6c5aaaef892a51841b25bf --head 821d724d41c28b97110e417500a6b8de167422d6 --title feat(libharfbuzz): implement buffer exports with a pinned backend --body /dev/shm/reviewer-run/precheck/14441/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base f1a7b02028ae50adaf6c5aaaef892a51841b25bf --head 821d724d41c28b97110e417500a6b8de167422d6 --json` | | python_syntax | passed | `/usr/bin/python3 -m py_compile tools/package_release.py` | | unit:tools/tests/test_package_release.py | passed | `/usr/bin/python3 -m unittest tools.tests.test_package_release` | | python_test_registration | passed | `/usr/bin/python3 tools/check_test_registration.py --scripts` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14441 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14441/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /dev/shm/reviewer-run/precheck/14441/head-821d724d41c2-ad2dff4c/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14441/head-821d724d41c2-ad2dff4c --json .gitmodules 3rdparty/harfbuzz core/libs/prx/libharfbuzz/Buffer.cpp core/libs/prx/libharfbuzz/CMakeLists.txt core/libs/prx/libharfbuzz/Export.cpp core/libs/prx/libharfbuzz/include/InventoryExports.hpp core/libs/tests/GuestHarfBuzzBuffer.cpp docs/dev/debt/libharfbuzz.md tools/package_release.py tools/tests/test_package_release.py` | | negative_controls | failed | `A pass means every candidate failed by assertion on base; a failure means at least one did not discriminate or could not run. See per-test results.` | ## Negative control The precheck's negative control runs the release test file against base. On base the new HarfBuzz tests fail (two `F` and one `E`), and the precheck reports `not_executable`; the failures are assertions and a missing-exception check, so the new tests discriminate the change. ## Findings **Blocking:** none. **Non-blocking:** - The ABI audit's 70 lexical findings are all the rename class: the old names are gone and their `_nid_postfix` names are defined. The NID check above confirms that the renamed symbols keep the same computed NIDs, which is the point of the convention. The audit still cannot prove the NID encoding, so that rests on the repository's `_nid_postfix` convention. - `GuestHarfBuzzBuffer.cpp` checks the adapter against the same HarfBuzz backend it links, so it tests the adapter's argument and layout handling, not HarfBuzz's own shaping or Unicode rules. The expected code points and clusters for the UTF-16 case are hard-coded and I checked them by hand. - Twenty-four exports still throw through `NotImplemented_nid_no_patch`, as the PR states; the debt file records them. ## Sources - Buffer adapter at head: https://github.com/boykopovar/AnyPS5/blob/821d724d41c28b97110e417500a6b8de167422d6/core/libs/prx/libharfbuzz/Buffer.cpp - Release notices at head: https://github.com/boykopovar/AnyPS5/blob/821d724d41c28b97110e417500a6b8de167422d6/tools/package_release.py#L74-L77 - Pinned backend notices: https://github.com/harfbuzz/harfbuzz/blob/a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc/src/ms-use/COPYING ## Not verified - No build: the adapter, the backend and both guest tests were not compiled or run; the `static_assert` layout checks were not compiled. - Windows and macOS paths of the static backend build, the `--exclude-libs` link option and the install rules were not run. - The NID encoding is verified only through the audit's computed values, not through a runtime lookup. - Hosted: at review time `conventions`, `eligibility`, `library-portability` and `report` were queued at this head.
BunnyFl commented 2026-11-03 03:24:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T03:24:48Z.

Review: APPROVED


First Windows run, plus a comparison with the console's own HarfBuzz build.

Windows 11, WinLibs GCC, BUILD_TESTING=ON, head 821d724d41 merged onto current main 7feb37ee3e (clean merge), with 3rdparty/harfbuzz at the pinned a1d9bfe628:

  • guest_harfbuzz_buffer_utf16, _properties and _lifetime pass. The backend compiles with one -Wsuggest-attribute=format warning in hb-buffer-verify.cc and no errors.
  • --exclude-libs,ALL works on MinGW too. The unpatched libharfbuzz.prx exports 36 names, 35 of them the _nid_postfix adapters, and none of the backend's own hb_* symbols.

There's no negative control on main: the test calls the new adapters, which don't exist there.

Firmware 13.42 system_ex/common_ex/lib/libSceVshHarfBuzz.sprx (sha256 48cbea0616729b66473528b1b234595b4117781b76910ef0511bd4f9465e9717) exports all eleven NIDs. This is disassembly only, not measured on a console. The bodies I read to their returns behave like the pinned upstream code this PR forwards to:

  • hb_buffer_get_length (0xb520: mov 0x60(%rdi),%eax; ret) and hb_buffer_get_direction (0xb1e0: mov 0x38(%rdi),%eax; ret) are plain loads.
  • hb_buffer_set_direction (0xb1d0) and hb_buffer_set_script (0xb1f0) store only when the object's writable flag at +4 is set, with no validation of the value. That's upstream's immutability check.
  • hb_buffer_get_glyph_infos (0xb530) writes *length only for a non-null pointer, then returns the array.
  • hb_buffer_create (0xac60) does calloc(1, 0xf0), sets reference count and writable flag to 1, and sets limits 0x3fffffff/0x1fffffff. Those match upstream's HB_BUFFER_MAX_LEN_DEFAULT/HB_BUFFER_MAX_OPS_DEFAULT.
  • hb_buffer_destroy (0xaef0) returns for null or an inert object, lock decls, and writes 0xffff2153 at zero. That's upstream's hb_object_destroy.

So delegating to real HarfBuzz is a faithful model here. None of these console bodies checks for null (at 0xb520, get_length dereferences %rdi directly), so the PR's null refusals are a host-safety choice. That fits the debt entry.

Not read: hb_buffer_add_utf16 (0xbd70, 817 bytes), hb_buffer_reset (0xadd0), hb_buffer_get_glyph_positions (0xb540) and the hb_buffer_guess_segment_properties target (0xa8d0). I also didn't determine the console's HarfBuzz version. Unicode-table differences in segment guessing are presumably possible and unchecked, which matches the "unknown console revision" debt entry.

The merge with #15365 will need a manual resolution: both change hb_ot_tag_to_script's stub lines in Export.cpp/InventoryExports.hpp.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5746876893 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14441#pullrequestreview-5746876893). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T03:24:48Z. **Review:** APPROVED --- First Windows run, plus a comparison with the console's own HarfBuzz build. **Windows 11, WinLibs GCC, `BUILD_TESTING=ON`,** head `821d724d41` merged onto current `main` `7feb37ee3e` (clean merge), with `3rdparty/harfbuzz` at the pinned `a1d9bfe628`: - `guest_harfbuzz_buffer_utf16`, `_properties` and `_lifetime` pass. The backend compiles with one `-Wsuggest-attribute=format` warning in `hb-buffer-verify.cc` and no errors. - `--exclude-libs,ALL` works on MinGW too. The unpatched `libharfbuzz.prx` exports 36 names, 35 of them the `_nid_postfix` adapters, and none of the backend's own `hb_*` symbols. There's no negative control on `main`: the test calls the new adapters, which don't exist there. **Firmware 13.42** `system_ex/common_ex/lib/libSceVshHarfBuzz.sprx` (sha256 `48cbea0616729b66473528b1b234595b4117781b76910ef0511bd4f9465e9717`) exports all eleven NIDs. This is disassembly only, not measured on a console. The bodies I read to their returns behave like the pinned upstream code this PR forwards to: - `hb_buffer_get_length` (`0xb520`: `mov 0x60(%rdi),%eax; ret`) and `hb_buffer_get_direction` (`0xb1e0`: `mov 0x38(%rdi),%eax; ret`) are plain loads. - `hb_buffer_set_direction` (`0xb1d0`) and `hb_buffer_set_script` (`0xb1f0`) store only when the object's writable flag at `+4` is set, with no validation of the value. That's upstream's immutability check. - `hb_buffer_get_glyph_infos` (`0xb530`) writes `*length` only for a non-null pointer, then returns the array. - `hb_buffer_create` (`0xac60`) does `calloc(1, 0xf0)`, sets reference count and writable flag to 1, and sets limits `0x3fffffff`/`0x1fffffff`. Those match upstream's `HB_BUFFER_MAX_LEN_DEFAULT`/`HB_BUFFER_MAX_OPS_DEFAULT`. - `hb_buffer_destroy` (`0xaef0`) returns for null or an inert object, `lock decl`s, and writes `0xffff2153` at zero. That's upstream's `hb_object_destroy`. So delegating to real HarfBuzz is a faithful model here. None of these console bodies checks for null (at `0xb520`, `get_length` dereferences `%rdi` directly), so the PR's null refusals are a host-safety choice. That fits the debt entry. Not read: `hb_buffer_add_utf16` (`0xbd70`, 817 bytes), `hb_buffer_reset` (`0xadd0`), `hb_buffer_get_glyph_positions` (`0xb540`) and the `hb_buffer_guess_segment_properties` target (`0xa8d0`). I also didn't determine the console's HarfBuzz version. Unicode-table differences in segment guessing are presumably possible and unchecked, which matches the "unknown console revision" debt entry. The merge with #15365 will need a manual resolution: both change `hb_ot_tag_to_script`'s stub lines in `Export.cpp`/`InventoryExports.hpp`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14441
No description provided.