Skip to content

test(png_enc): add work-buffer recreate with smaller effective width test - #24594

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarrasFederico:test/png-encoder-work-buffer-recreate
Nov 21, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarrasFederico:test/png-encoder-work-buffer-recreate

Conversation

@MarrasFederico

Copy link
Copy Markdown
Contributor

What

Recreate a PNG encoder context in the same work buffer with a smaller width limit. Check that it rejects the formerly valid image, accepts a smaller image and leaves the surrounding canaries intact.

Tested

  • Linux Release: ctest -R "^(guest_png_enc_context)$" passed on 03aef0a067ae.
  • Windows MSYS2 UCRT64: the targeted CTest passed on three consecutive runs.
  • The test failed with its corresponding production behavior temporarily disabled. The original production source was restored.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 03aef0a067:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_png_enc_context_tests built cleanly.
  • CTest (guest_png_enc_context):
    1/1 Test #5118: guest_png_enc_context ............   Passed    1.38 sec
    100% tests passed, 0 tests failed out of 1
    
  • Code reading:
    • Verified that the work-memory canaries in workMem2 are properly checked around the buffer boundaries and remain unmodified after encode and delete operations
    • Verified that scePngEncCreate correctly initializes in the previously used work buffer with smaller width param and validates against largeEncode (returning 0x80690103 / SCE_PNG_ENC_ERROR_INVALID_IMAGE_PARAM)
    • Verified that the rejected encode does not modify output buffer or info struct (retaining original values)
    • Verified that the smaller image encode and decode succeeds, matches expected pixel data, and completes without memory corruption
    • Verified AGENTS.md compliance regarding no comments, Conventional Commits, clean diff, and lack of leaks or side effects

Looks Good To Me

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this test change; it covers recreation with a smaller width limit and checks rejection, successful encoding, and work-buffer canaries.

What I ran

Reviewed head 03aef0a067ae0a3862de92d30ced963812a8e5e1. Read the PR description, commit summary, manifest, complete diff, and all 103 added lines in core/libs/tests/GuestPngEncContext.cpp. The repository reader was available as repo_read.py; no tests were run in this review.

Results

Check Result Note
Changed lines reviewed passed All added lines read
Targeted tests not run Author reports Linux and Windows runs
Negative control not run Author reports the test failed when behavior was disabled

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not independently run the test or verify the author-reported results. Only core/libs/tests/GuestPngEncContext.cpp was changed and reviewed; there were no excluded changed files.

To get this to a good state

Nothing is required.

@kiwe147

kiwe147 commented Nov 20, 2026

Copy link
Copy Markdown

Tested head 03aef0a067, applied with git apply on main fd4aeed483 together with the other sixteen PRs of one batch (#24596, #24595, #24599, #24600, #24602, #24593, #24659, #24651, #24626, #24625, #24624, #24456, #24656, #22380, #24502, #24351). All seventeen applied without conflicts. The tree built except libSceAjm.prx: #24659 breaks it with duplicate patched export name: -qLsfDAywIY (checked alone on main, reported there). No other target failed to build.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_png_enc_context (1 test) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6524 tests) on the RTX 3080 has 4 failures, and all 4 also fail on main fd4aeed483 (agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10). The 2125 agc_/video tests on the iGPU fail agc_driver_stencil_plane_memory (also on main), agc_driver_store_over_untracked (also fails alone on main on this iGPU, 6 of 6) and agc_driver_image_table_packed_guards (passes 5 of 5 alone on this tree, known flaky). None of this batch touches AGC.

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants