fix: address decoder memory leaks, ELF parser safety, and python tool… #615
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/615"
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 premkumar0184 on 2026-10-05T05:58:09Z.
… bugs
What
Tested
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T07:26:39Z.
Thanks for looking through these, and welcome. I read it file by file. Some of it is useful, but it can't go in as one PR, and one change breaks the PR overlap check. Details below.
One topic per PR. CONTRIBUTING asks for one topic per PR, and this one has seven unrelated changes: the JPEG and PNG decoders, the Linux ELF patcher,
relinker/main.cpp, and three tools scripts. Could you split it, and fill in the template for each (What, Tested, the checklist and the AI-assisted line)? The CI run also still needs workflow approval, so nothing has been built or tested in CI yet.tools/pr_overlap.py,merge(): this inverts the conflict check.git merge-tree --write-tree --name-onlyexits with 1 when there are conflicts and then lists the conflicted files after the tree id. For example, #569 against main exits with 1 and lists four files. The old line returned those files when the exit code was non-zero. The new line returns them only when it is 0, and then the list is always empty. Soscan()would treat every conflicting PR as clean, andconflicts()would never report a pair. Please drop this hunk. Theif not linesguard can stay, if you have seen a case where git prints nothing.The
core/libs/prx/**/*.cpppathspec doesn't change anything. Without:(glob), a*in a git pathspec also matches/, socore/libs/prx/*.cppalready matches every.cppbelowprx/(git ls-filesgives the same 502 files for both). Exports in subdirectories are already found.PNG
MAX_DIMENSIONlowered to 16384. This changes what the guest sees:scePngDecwould now reject valid PNGs larger than 16384 pixels on a side, which the PNG format allows (up to 2^31 - 1). If the console's libScePngDec has a lower limit, it needs a source, a test and the console's error code. Without one, please leave the limit as it is.JPEG dimension checks. A JPEG header stores width and height in 16 bits, and the file already has
MAX_DIMENSION = 0xFFFF, so the new checks inParseHeaderandDecodecan never trigger.unique_ptrguards. The only leak was ifimage.pixels.assignthrewbad_alloc, so the guard is a small improvement. If you keep it, create the guard right after the null check and drop the manualstbi_image_freebefore it, so there is only one owner.LinuxElfPatcher.cpp. Thememcpyreads are fine. The new size check covers up toe_phnum, but the function also writese_shnumande_shstrndx, which come after it. As far as I can see, the input has already been parsed by then (result.OriginalHeaders), so a buffer that short can't reachPatch. If you want the check anyway, it should cover the whole 64-byte header and come with a test.relinker/main.cpp,package_release.py,progress.py. Thetolowerandmemcpyedits don't change behaviour. TheWINLIBS_BINoverride and the zero-total guard are separate small topics. Each of them could be its own PR, with a line on when it's needed (forprogress.py, which group can have zero functions?).So my suggestion: drop the
pr_overlap.pyand pathspec changes and the PNG limit, and send the rest as separate PRs, each with its own test or a note on how you checked it.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T21:20:29Z.
Thanks again for going through these. I'm closing this one. It bundles seven unrelated changes, and one of them (
tools/pr_overlap.py) inverts the conflict check, as I described on 10-05. There has been no update since.Two parts are worth having on their own:
LinuxElfPatcher.cppsize check, extended to covere_shnumande_shstrndx;unique_ptrguard, created right after the null check, as the only owner.If you decide to continue, please open each as its own PR with the template filled in. You can also reopen this one if you'd rather split it from here.
Pull request closed