fix(libSceFont): accept overlapping render surface rows #8250
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8250"
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 vittoriosalvadore on 2026-10-20T07:01:38Z.
What
Accept a zero row stride and preserve short positive strides in Font character rendering. Rows may overlap: for positive dimensions their address range is
(height - 1) * stride + width * pixelSize, rather thanheight * stride. An allocation covering that range is sufficient; the API has no allocation length to validate the caller's actual storage. Clipping by surface dimensions and scissor keeps raster writes inside it.Remove the earlier short-stride rejection and keep main's style-frame/baseline error precedence. Zero width or height retains main's successful metrics-only result, an empty update rectangle and no pixel writes. Negative strides still return
SCE_FONT_ERROR_NO_SUPPORT_SURFACE; the difference from the measured module is explicit in technical debt.Source: BunnyFl's native x86-64 execution of firmware 13.42 Font/FontFt modules and the collaborator's requested correction. This is a published firmware-module harness result, not our own measurement or a console-hardware run. The reported four-byte surface metadata with one-byte coverage writes remains an unresolved format difference; this patch preserves the existing host four-byte raster and records that gap.
Tested
Windows x86-64, WinLibs GCC 15.2.0 r7 (UCRT/POSIX), CMake 4.3.1 and Ninja 1.13.2; root Release configuration, BUILD_TESTING=ON, relinker-only OFF, system dependencies OFF, pinned bundled submodules. Final head
6b6a14635c38229ac220ea51a2b2b7a8d96458c8, based on mainf7f03daf52f11191174b1be089a56e268390a707.cmake --build build --parallel 3 --target libs relinker, plus all focused Font test targets.ctest --test-dir build -R '^(font_render_surface|guest_font.*|guest_system_font|font_face_lifetime.*|guest_freetype)$' -V --timeout 30 --parallel 2.0x80460050. Negative control 2: reinsert only the old early stride guards into the current Render.cpp. It fails in the mixed-invalid style-frame case by throwing instead of retaining the earlier error. Restore committed production sources, rebuild and rerun all 17: pass, zero skips. The production baseline used for these controls is byte-identical in the final main snapshot.gpt-6-astra, reasoning high) final review completed before push.The regression uses an asymmetric generated TrueType glyph with the real Font/FontFt/FreeType libraries. It compares the complete buffer with a wide-stride reference projected into overlapping rows in drawing order, including zero coverage inside the update rectangle. Guards surround the declared extent. Coverage includes all three character-rendering exports; strides 0, 1, 16, 64, 130, exact, padded and row-size-minus-one; one- and four-byte host pixels; scissor; 0x00/0xEE initial buffers; height 1; zero width/height; invalid descriptors; mixed-invalid errors and a missing driver with an active style frame followed immediately by a valid rendering.
The one-byte address rule is checked against the formula reported by BunnyFl. The fixture is not their DFHEI5-SONY2022.ttf, so it does not claim to reproduce that font's 309 changed bytes. Four-byte cases verify the current host raster's addressing and extent, not equivalence with the reported firmware raster.
pr_overlapexamined 1490 open PRs and found no confirmed overlap. Its only uncompleted shared-file comparison was #12757's Font debt file; its complete diff was reviewed manually: it adds GetLibrary/SetFontsOpenMode test/debt entries, not surface rendering or this regression. No dependency is required. The collaborator's existing branch merge is preserved in history.No title, proprietary font, console-hardware run, Linux/macOS execution of this revision, GPU execution or full repository CTest run is claimed. Full upstream Linux/Windows CI requires a maintainer dispatch under CONTRIBUTING.md.
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)Imported from boykopovar/AnyPS5. Originally posted by vittoriosalvadore on 2026-10-22T05:41:33Z.
Thank you. Rebased #8250 on main and resolved the documentation conflict. All seven focused Font tests pass with zero skips; the full Windows library/relinker build and negative control also pass. A fresh Astra high review found no issues. The branch is ready for full upstream CI.
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T13:48:41Z.
Review: COMMENTED
Checked against main
522e32e3b6and core/libs/prx/libSceFont/src/Layout.cpp / Render.cpp on main:buffer + row*widthByte + column*bpp, clipped to width/height (Layout.cpp:164-188). With height 1, width 80 and stride 16, main only touches bytes 0-79, which is in bounds for an 80-byte buffer, yet this PR throws. With more rows, a short stride makes rows overlap but stays within(h-1)*stride + w*bpp. The "wrote beyond buffer" result comes from the test treating the buffer asstride*height. Could the description and debt entry describe this as a guard for an unverified case rather than an overflow fix? Has any title been seen passing such a surface?sceFontRenderCharGlyphImagethe guard now runs before the style-frame/baseline errors (preRc), so that error code is replaced by a throw when both conditions hold.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.