fix(libScePngDec): stop callback input at the PNG boundary #18361
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18361"
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 Ondra97 on 2026-11-11T12:13:06Z.
What
scePngDecDecodeWithInputControlkeeps requesting input after a complete PNG image. When the next callback reports an error, a valid image fails to decode. Bound each read by the declared PNG chunk length and stop after the complete IEND chunk, including its CRC. The existing direct decode path still validates chunks and image data.The framing follows PNG section 11.2.4. Exact native callback counts and read-ahead remain unmeasured and are recorded in the library's debt entry.
Regression coverage uses literal expected RGBA pixels, callback chunks of 1/3/7/12/1024 bytes, a 2 KiB post-IDAT ancillary chunk containing a false IEND trailer, trailing bytes offered in the same callback, repeated decoding without another callback, and incomplete-IEND EOF/error cases.
Tested
Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X; 32 GB RAM; NVIDIA RTX 4070 Ti SUPER (codec tests do not use the GPU). WinLibs MinGW-w64 GCC 15.2.0 r7, CMake 4.3.1, Ninja, Release.
Base reproduction:
1b485ff74570a0508ef5cd30409d00659a9bada1. Final commit:2464b95fe12373ab2a4b46024b6b29390d615935, based ona57e435a537f7a71ef8b3c780f65033d4b53f617. The intervening main change only extends release-workflow timeouts; codec and test source files are unchanged.A fresh full-project configuration used
BUILD_TESTING=ON,ANYPS5_RELINKER_ONLY=OFFand exact current submodules. Builtdecoder_png_tests,guest_png_dec_testsandguest_png_dec_input_control_testswith--parallel 6.All four selected tests passed (three runtime tests plus the public-header audit). Conventions and
git diff --checkpassed. A separate read-only review found no blocking defect. Linux, macOS, console, titles and the full CTest suite were not tested.Hosted Windows job 130515344372 passed for head
2464b95fe12373ab2a4b46024b6b29390d615935; its changed-test selection ranguest_png_dec_input_controlsuccessfully (1/1). Conventions, library portability, intake and eligibility also passed. The Linux and other unrelated jobs were skipped.Pre-opening
python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/fix-png-input-end-boundaryscanned 1,973 open PR heads. It exited 2 because #14212 conflicts with main and its shared debt file could not be compared automatically. I manually compared head6b4941bfe250142672c12b48b7b6c706b9691452: that file only gains three blank lines. There is no implementation overlap or ordering dependency.Additional integration validation: current main
0effa485f96a4fcf8fef433a09cdd862c65b7767plus #18361 (2464b95fe12373ab2a4b46024b6b29390d615935), #18370 (c8388f97ab26a188bd07751a2f5ba2afce058bc6) and #18387 (887c2c6e51e6b926a773abaa43e9f15b71af1efc), composed locally as7b8bc0d80db09dee5e39bcdf5159d8b8791d9db9. A fresh full-project build passed all 10 focused PNG/JPEG runtime CTests andpublic_headers(11/11). A separate temporary PNG probe passed in fresh processes through both raw and production-NID-resolved exports with an isolated patched libc/kernel/PNG closure. It checks level-0 stored RGB/RGBA streams, literal decoded pixels, 1/7/full-image callback chunks with an error only after IEND, repeated decode without another callback and row padding. This is synthetic Windows integration coverage; no title or console run is claimed. Probe source and reproduction commands are included in #18387.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 PrivacyOnion on 2026-11-11T16:25:07Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
2464b95fe1:tools/check_conventions.pypassed;git diff --checkclean.guest_png_dec_input_control_testsbuilt cleanly.guest_png_dec_input_control):core/libs/prx/libScePngDec/Export.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me