feat(libSceLibcInternal): implement wide num_put::_Iput #24905

Merged
0x70776c merged 6 commits from upstream-pr/24905 into main 2026-12-03 12:33:31 +00:00
0x70776c commented 2026-11-21 10:16:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 0x70776c on 2026-11-21T10:16:13Z.


What

Implement std::num_put<wchar_t>::_Iput(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char*, size_t) (_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_IputES3_RSt8ios_basewPcm, NID 4pQ3B1BTMgo) in libSceLibcInternal:

  • Read guest digits, widen through ctype<wchar_t> when present (or unsigned byte widening fallback), apply numpunct<wchar_t> grouping/thousands separators while preserving sign and 0x/0X hex prefixes, and emit padded wide output via LibcRepeatWideElement_nid_no_patch and LibcPutWideElements_nid_no_patch.
  • Validate digits != nullptr before constructing the temporary buffer when count != 0.
  • Add unit tests in core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp (guest_libc_internal_wide_num_put_field).
  • Remove the resolved debt entry via docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md.

Tested

  • python3 tools/check_conventions.py --base origin/main
  • cmake --build build --target guest_libc_internal_wide_num_put_field_tests --parallel
  • ctest --test-dir build --output-on-failure -R '^(guest_libc_internal_wide_num_put_field|public_headers)$' (2/2 passed)

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
  • 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
  • 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:5426781131 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905). Originally posted by [0x70776c](https://github.com/0x70776c) on 2026-11-21T10:16:13Z. --- ### What Implement `std::num_put<wchar_t>::_Iput(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char*, size_t)` (`_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_IputES3_RSt8ios_basewPcm`, NID `4pQ3B1BTMgo`) in `libSceLibcInternal`: - Read guest `digits`, widen through `ctype<wchar_t>` when present (or unsigned byte widening fallback), apply `numpunct<wchar_t>` grouping/thousands separators while preserving sign and `0x`/`0X` hex prefixes, and emit padded wide output via `LibcRepeatWideElement_nid_no_patch` and `LibcPutWideElements_nid_no_patch`. - Validate `digits != nullptr` before constructing the temporary buffer when `count != 0`. - Add unit tests in `core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp` (`guest_libc_internal_wide_num_put_field`). - Remove the resolved debt entry via `docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md`. ### Tested - `python3 tools/check_conventions.py --base origin/main` - `cmake --build build --target guest_libc_internal_wide_num_put_field_tests --parallel` - `ctest --test-dir build --output-on-failure -R '^(guest_libc_internal_wide_num_put_field|public_headers)$'` (2/2 passed) ### Checklist - [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 and the licence notice of code adapted from upstream - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [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
PrivacyOnion commented 2026-11-21 10:17:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T10:17:42Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 13c6e21e15:

  • Conventions: tools/check_conventions.py failed.
    (pull request): error: [pr-template] Fill in the pull request template: answer AI-assisted with yes or no
    (pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none
    2 findings, 2 errors; GitHub shows at most 10 error annotations, the job summary lists all
    
  • Build: guest_libc_internal_wide_num_put_field_tests built cleanly.
  • CTest (guest_libc_internal_wide_num_put_field):
    1/1 Test #4532: guest_libc_internal_wide_num_put_field ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004578627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6004578627). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T10:17:42Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `13c6e21e15`: - **Conventions**: `tools/check_conventions.py` failed. ``` (pull request): error: [pr-template] Fill in the pull request template: answer AI-assisted with yes or no (pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none 2 findings, 2 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` - **Build**: `guest_libc_internal_wide_num_put_field_tests` built cleanly. - **CTest** (`guest_libc_internal_wide_num_put_field`): ``` 1/1 Test #4532: guest_libc_internal_wide_num_put_field ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` Requesting changes for the points above.
MarcZX10 commented 2026-11-21 10:33:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:33:03Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: guard null digits when count is positive before constructing the string.

What I ran

Reviewed head 13c6e21e1571537dee7609ebd6ef996d403eb850. I read the prepared description, commits, manifest and diff, then inspected all changed source files and targeted locale, stream output and copy helper context through repo_read.py. No commands or tests were run.

Results

Check Result Note
Changed code review failed Null input can be read before validation
Build and tests not run Author reports build and 2/2 tests passed

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:111: std::string raw(count, '\0') executes before the checked guest copy. When count > 0 and digits == nullptr, constructing the string passes a null source to the string constructor, causing undefined behavior before GuestCopyIn_nid_no_patch can reject it. Validate digits before this construction, consistent with the neighboring narrow _Iput implementation.

Non-blocking

None.

Not verified

Build and test results were author-reported in the PR description and were not run in this review. The manifest lists six changed files; all six were read: core/libs/prx/libSceLibcInternal/CMakeLists.txt, core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/WideNumPutField.cpp, core/libs/prx/libSceLibcInternal/include/ErrExports.hpp, core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp, and docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md. files.json was not available through the reader; the manifest showed every changed file included.

To get this to a good state

Validate the digit pointer before constructing raw, then rerun the reported build and targeted CTest commands on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004670547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6004670547). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T10:33:03Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: guard null `digits` when `count` is positive before constructing the string. ## What I ran Reviewed head `13c6e21e1571537dee7609ebd6ef996d403eb850`. I read the prepared description, commits, manifest and diff, then inspected all changed source files and targeted locale, stream output and copy helper context through `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | failed | Null input can be read before validation | | Build and tests | not run | Author reports build and 2/2 tests passed | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:111`: `std::string raw(count, '\0')` executes before the checked guest copy. When `count > 0` and `digits == nullptr`, constructing the string passes a null source to the string constructor, causing undefined behavior before `GuestCopyIn_nid_no_patch` can reject it. Validate `digits` before this construction, consistent with the neighboring narrow `_Iput` implementation. ### Non-blocking None. ## Not verified Build and test results were author-reported in the PR description and were not run in this review. The manifest lists six changed files; all six were read: `core/libs/prx/libSceLibcInternal/CMakeLists.txt`, `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp`, `core/libs/prx/libSceLibcInternal/include/ErrExports.hpp`, `core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp`, and `docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md`. `files.json` was not available through the reader; the manifest showed every changed file included. ## To get this to a good state Validate the digit pointer before constructing `raw`, then rerun the reported build and targeted CTest commands on the updated head.
PrivacyOnion commented 2026-11-21 11:02:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T11:02:26Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_wide_num_put_field_tests built cleanly.
  • CTest (guest_libc_internal_wide_num_put_field):
    1/1 Test #4532: guest_libc_internal_wide_num_put_field ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/include/ErrExports.hpp, core/libs/prx/libSceLibcInternal/WideNumPutField.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified stream validation: stream, stream->locale, and *stream->locale null checks in WideNumPutField.cpp:109 reject uninitialized stream state with std::invalid_argument.
    • Verified digits buffer safety: checked count != 0 && digits == nullptr, guest copy via GuestCopyIn_nid_no_patch into temporary std::string raw before manipulation.
    • Verified prefix and grouping mechanics: signs (+/-) and hex prefixes (0x/0X with IosHex) are excluded from grouping offset calculations, and grouping stops on CHAR_MAX or non-positive sizes.
    • Verified padding and stream width handling: fill insertion obeys IosAdjustField (left, internal, right/default), output is emitted via LibcPutWideElements_nid_no_patch / LibcRepeatWideElement_nid_no_patch, and stream->width is reset to 0.
    • Verified AGENTS.md compliance: no comments in source code, technical debt fragment feat-libcinternal-wide-num-put-iput.md correctly removes the debt entry, and no unapproved stubs or files added.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004788235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6004788235). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T11:02:26Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `dccee43e62`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_wide_num_put_field_tests` built cleanly. - **CTest** (`guest_libc_internal_wide_num_put_field`): ``` 1/1 Test #4532: guest_libc_internal_wide_num_put_field ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/include/ErrExports.hpp`, `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified stream validation: stream, stream->locale, and *stream->locale null checks in WideNumPutField.cpp:109 reject uninitialized stream state with std::invalid_argument. - Verified digits buffer safety: checked count != 0 && digits == nullptr, guest copy via GuestCopyIn_nid_no_patch into temporary std::string raw before manipulation. - Verified prefix and grouping mechanics: signs (+/-) and hex prefixes (0x/0X with IosHex) are excluded from grouping offset calculations, and grouping stops on CHAR_MAX or non-positive sizes. - Verified padding and stream width handling: fill insertion obeys IosAdjustField (left, internal, right/default), output is emitted via LibcPutWideElements_nid_no_patch / LibcRepeatWideElement_nid_no_patch, and stream->width is reset to 0. - Verified AGENTS.md compliance: no comments in source code, technical debt fragment feat-libcinternal-wide-num-put-iput.md correctly removes the debt entry, and no unapproved stubs or files added. Looks Good To Me
MarcZX10 commented 2026-11-21 11:09:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T11:09:16Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: initialize wide facet IDs and resolve facets using the repository’s locale rules before formatting.

What I ran

Reviewed head dccee43e622a1dac3b87728846763c83f85c010f; no commands or tests were run. Read the prepared description, commits, manifest, diff, and all six changed files; compared the implementation with locale and output helpers in GuestLocale.hpp, LocaleSupport.cpp, NumGet.cpp, NumPutField.cpp, and TimeGetFields.cpp.

Results

Check Result Note
Code review failed One verified defect
Build and tests not run Description reports author-run checks; not independently verified
Other changed files passed No additional defect found in inspected changes

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:35 reads the wide numpunct facet ID without initializing it. The ID is initialized to zero in LocaleSupport.cpp, and FindFacet treats zero as absent, so StreamWideNumpunct falls back to constructing a standalone default facet. A custom locale's grouping and thousands separator are then ignored; additionally, if the fallback factory returns null, lines 120–121 dereference it. Initialize the ID and look up the stream facet with the same transparent-locale behavior used by the existing locale helpers.

Not verified

Build and test claims in the PR description were not run during this review. The reviewed files are the six entries in the manifest: CMakeLists.txt, Err.cpp, WideNumPutField.cpp, ErrExports.hpp, tests/WideNumPutField.cpp, and the debt change file. No files were excluded by the manifest.

To get this to a good state

Initialize facet IDs consistently with the existing locale helpers and cover the uninitialized-ID case in the tests. Then rerun the reported convention check, build, and targeted CTest commands on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004811566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6004811566). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T11:09:16Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: initialize wide facet IDs and resolve facets using the repository’s locale rules before formatting. ## What I ran Reviewed head `dccee43e622a1dac3b87728846763c83f85c010f`; no commands or tests were run. Read the prepared description, commits, manifest, diff, and all six changed files; compared the implementation with locale and output helpers in `GuestLocale.hpp`, `LocaleSupport.cpp`, `NumGet.cpp`, `NumPutField.cpp`, and `TimeGetFields.cpp`. ## Results | Check | Result | Note | |---|---|---| | Code review | failed | One verified defect | | Build and tests | not run | Description reports author-run checks; not independently verified | | Other changed files | passed | No additional defect found in inspected changes | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:35` reads the wide `numpunct` facet ID without initializing it. The ID is initialized to zero in `LocaleSupport.cpp`, and `FindFacet` treats zero as absent, so `StreamWideNumpunct` falls back to constructing a standalone default facet. A custom locale's grouping and thousands separator are then ignored; additionally, if the fallback factory returns null, lines 120–121 dereference it. Initialize the ID and look up the stream facet with the same transparent-locale behavior used by the existing locale helpers. ## Not verified Build and test claims in the PR description were not run during this review. The reviewed files are the six entries in the manifest: `CMakeLists.txt`, `Err.cpp`, `WideNumPutField.cpp`, `ErrExports.hpp`, `tests/WideNumPutField.cpp`, and the debt change file. No files were excluded by the manifest. ## To get this to a good state Initialize facet IDs consistently with the existing locale helpers and cover the uninitialized-ID case in the tests. Then rerun the reported convention check, build, and targeted CTest commands on the updated head.
MarcZX10 commented 2026-11-21 11:57:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T11:57:39Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: fix grouping termination so CHAR_MAX does not become a subsequent group size.

What I ran

Reviewed head 77226e549e2a63378365e1d4316736ff2fced159 using the pinned reader repo_read.py. No commands or tests were run; the build and test results in the PR description are author-reported.

Results

Check Result Note
Diff and targeted source review passed Implementation, tests, and relevant locale types read
Build and tests not run Reported by author, not independently confirmed

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:84: When a grouping pattern ends with a positive group followed by CHAR_MAX (for example "\\2\\x7f"), this loop advances only while the next byte is positive. After consuming the first group it leaves the pointer on CHAR_MAX; the next iteration interprets that terminator as a signed negative value, which is not equal to CHAR_MAX when CHAR_MAX is 127, and casts it to a large size_t. The loop then inserts a separator at an invalid position, causing incorrect output or invalid iterator use. Stop when the next grouping byte is CHAR_MAX; add a case with enough digits to cross the terminator. The existing test uses only five digits with a group of two, so it does not exercise another iteration after that terminator.

Non-blocking

None.

Not verified

No tests, build, or convention checks were run. The PR description reports these checks as passing. All changed files listed in the manifest were read: core/libs/prx/libSceLibcInternal/CMakeLists.txt, core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/WideNumPutField.cpp, core/libs/prx/libSceLibcInternal/include/ErrExports.hpp, core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp, and docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md. No files were excluded in the manifest.

To get this to a good state

Fix the grouping loop’s CHAR_MAX handling and add coverage for digits extending beyond the final specified group. Then rerun the reported build and tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6005042863 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6005042863). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T11:57:39Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: fix grouping termination so `CHAR_MAX` does not become a subsequent group size. ## What I ran Reviewed head `77226e549e2a63378365e1d4316736ff2fced159` using the pinned reader `repo_read.py`. No commands or tests were run; the build and test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Implementation, tests, and relevant locale types read | | Build and tests | not run | Reported by author, not independently confirmed | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:84`: When a grouping pattern ends with a positive group followed by `CHAR_MAX` (for example `"\\2\\x7f"`), this loop advances only while the next byte is positive. After consuming the first group it leaves the pointer on `CHAR_MAX`; the next iteration interprets that terminator as a signed negative value, which is not equal to `CHAR_MAX` when `CHAR_MAX` is 127, and casts it to a large `size_t`. The loop then inserts a separator at an invalid position, causing incorrect output or invalid iterator use. Stop when the next grouping byte is `CHAR_MAX`; add a case with enough digits to cross the terminator. The existing test uses only five digits with a group of two, so it does not exercise another iteration after that terminator. ### Non-blocking None. ## Not verified No tests, build, or convention checks were run. The PR description reports these checks as passing. All changed files listed in the manifest were read: `core/libs/prx/libSceLibcInternal/CMakeLists.txt`, `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp`, `core/libs/prx/libSceLibcInternal/include/ErrExports.hpp`, `core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp`, and `docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md`. No files were excluded in the manifest. ## To get this to a good state Fix the grouping loop’s `CHAR_MAX` handling and add coverage for digits extending beyond the final specified group. Then rerun the reported build and tests.
PrivacyOnion commented 2026-11-21 12:14:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T12:14:47Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 77226e549e:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_wide_num_put_field_tests built cleanly.
  • CTest (guest_libc_internal_wide_num_put_field):
    1/1 Test #4558: guest_libc_internal_wide_num_put_field ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/include/ErrExports.hpp, core/libs/prx/libSceLibcInternal/WideNumPutField.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified null and bounds checks for stream and digits buffers in core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:113-116.
    • Inspected facet ID lazy initialization and locking with _Locksyslock_nid_postfix/_Unlocksyslock_nid_postfix in FindFacet.
    • Checked grouping termination logic and group repetition in InsertWideSeparators for CHAR_MAX and negative group values in core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:78-85.
    • Audited field alignment and padding logic across Left, Internal, and Right adjustments in PutWideField in core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:87-111.
    • Verified test coverage and state restoration in core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6005116227 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6005116227). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T12:14:47Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `77226e549e`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_wide_num_put_field_tests` built cleanly. - **CTest** (`guest_libc_internal_wide_num_put_field`): ``` 1/1 Test #4558: guest_libc_internal_wide_num_put_field ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/include/ErrExports.hpp`, `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified null and bounds checks for stream and digits buffers in core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:113-116. - Inspected facet ID lazy initialization and locking with _Locksyslock_nid_postfix/_Unlocksyslock_nid_postfix in FindFacet. - Checked grouping termination logic and group repetition in InsertWideSeparators for CHAR_MAX and negative group values in core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:78-85. - Audited field alignment and padding logic across Left, Internal, and Right adjustments in PutWideField in core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:87-111. - Verified test coverage and state restoration in core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp. Looks Good To Me
MarcZX10 commented 2026-11-21 12:38:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T12:38:55Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the review is complete and the inspected evidence supports merging.

What I ran

Reviewed head a87e21b4701f3aa06da49f77a2235a4bcb018376. No commands or tests were run in this review.

Results

Check Result Note
Source review passed Changed implementation and tests inspected
Build and tests not run Results in the PR description are author reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

Build, tests, and runtime behavior were not independently verified. All six changed files listed in the manifest were read: CMakeLists.txt, Err.cpp, WideNumPutField.cpp, include/ErrExports.hpp, tests/WideNumPutField.cpp, and docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md. No files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6005236453 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6005236453). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T12:38:55Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the review is complete and the inspected evidence supports merging. ## What I ran Reviewed head `a87e21b4701f3aa06da49f77a2235a4bcb018376`. No commands or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Changed implementation and tests inspected | | Build and tests | not run | Results in the PR description are author reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Build, tests, and runtime behavior were not independently verified. All six changed files listed in the manifest were read: `CMakeLists.txt`, `Err.cpp`, `WideNumPutField.cpp`, `include/ErrExports.hpp`, `tests/WideNumPutField.cpp`, and `docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md`. No files were excluded. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-22 15:27:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T15:27:59Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the inspected implementation handles the reviewed formatting and grouping cases, but the reported build and test runs were not independently verified.

What I ran

Reviewed head 74e79cb9c3e4c39ea9c4ca66a01bb51b57fa7236 using the prepared diff and pinned repo_read.py reader. No build or test commands were run. Read core/libs/prx/libSceLibcInternal/CMakeLists.txt, WideNumPutField.cpp, tests/WideNumPutField.cpp, include/ErrExports.hpp, and core/libs/prx/libc/include/GuestLocale.hpp; the manifest lists all six changed files as included. The included full text was available through the pinned reader.

Results

Check Result Note
Diff review passed Formatting and grouping paths inspected
Build and tests not run Reported by the author only

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports convention checks, a targeted build, and two passing CTest checks; I did not run them. Runtime behavior beyond the inspected test cases was not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013017428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6013017428). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T15:27:59Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the inspected implementation handles the reviewed formatting and grouping cases, but the reported build and test runs were not independently verified. ## What I ran Reviewed head `74e79cb9c3e4c39ea9c4ca66a01bb51b57fa7236` using the prepared diff and pinned `repo_read.py` reader. No build or test commands were run. Read `core/libs/prx/libSceLibcInternal/CMakeLists.txt`, `WideNumPutField.cpp`, `tests/WideNumPutField.cpp`, `include/ErrExports.hpp`, and `core/libs/prx/libc/include/GuestLocale.hpp`; the manifest lists all six changed files as included. The included full text was available through the pinned reader. ## Results | Check | Result | Note | |---|---|---| | Diff review | passed | Formatting and grouping paths inspected | | Build and tests | not run | Reported by the author only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author reports convention checks, a targeted build, and two passing CTest checks; I did not run them. Runtime behavior beyond the inspected test cases was not verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-25 08:15:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T08:15:33Z.

Review: APPROVED


Reviewed — looks good

The implementation and its added tests cover the stated wide integer formatting behavior at head 86b60147528413a4b079a5c235c35ee2daf15754; no blocking defect was identified in the files reviewed.

What I ran

No commands were run. I inspected the prepared diff and source files through repo_read.py; the build and test commands listed in the PR description are author-reported, not independently verified.

Results

Check Result Note
Source review passed Reviewed 8 of 8 changed files
Build and tests not run Results are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

The build, convention check, and CTest results were not independently run. No files were excluded by the manifest; all changed files were read: core/libs/prx/libSceLibcInternal/CMakeLists.txt, core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/WideNumPutField.cpp, core/libs/prx/libSceLibcInternal/include/ErrExports.hpp, core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp, core/libs/prx/libc/include/GuestLocale.hpp, core/libs/prx/libc/src/LocaleSupport.cpp, and docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6053982758 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6053982758). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T08:15:33Z. **Review:** APPROVED --- # Reviewed — looks good The implementation and its added tests cover the stated wide integer formatting behavior at head `86b60147528413a4b079a5c235c35ee2daf15754`; no blocking defect was identified in the files reviewed. ## What I ran No commands were run. I inspected the prepared diff and source files through `repo_read.py`; the build and test commands listed in the PR description are author-reported, not independently verified. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Reviewed 8 of 8 changed files | | Build and tests | not run | Results are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The build, convention check, and CTest results were not independently run. No files were excluded by the manifest; all changed files were read: `core/libs/prx/libSceLibcInternal/CMakeLists.txt`, `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp`, `core/libs/prx/libSceLibcInternal/include/ErrExports.hpp`, `core/libs/prx/libSceLibcInternal/tests/WideNumPutField.cpp`, `core/libs/prx/libc/include/GuestLocale.hpp`, `core/libs/prx/libc/src/LocaleSupport.cpp`, and `docs/dev/debt/changes/feat-libcinternal-wide-num-put-iput.md`. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-25 18:06:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:06:52Z.

Review: DISMISSED


Reviewed — changes requested

Changes are required before merge: propagate output iterator failure state from the wide output helpers.

What I ran

Reviewed head e113c15386da0a868f3d95a6c4cded6b71c19e61. Read the prepared description, commits, diff, manifest, review README, and all changed source files through the pinned reader. No build or tests were run; the commands listed in the description are author-reported.

Results

Check Result Note
Source review failed Found lost iterator failure state
Build and tests not run Author-reported only

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:141: PutWideField assigns the return of LibcRepeatWideElement_nid_no_patch, but that helper calls PutWideElement on a local iterator copy and returns the unchanged copy. A failed stream-buffer overflow therefore sets only a temporary iterator's failed flag. The same applies to the wide element helper at lines 145 and 152. _Iput can return an iterator that still reports success after output failure, contrary to the test's stated behavior. Update the helpers to propagate the failure flag (or write through an interface that mutates the caller's iterator), and cover failure during both padding and digit output.

Non-blocking

None.

Not verified

No build or tests were run in this review, and no behavior was checked on a physical console. The author reports a conventions check, target build, and two passing CTest cases. All eight changed files listed as reviewed in the manifest were read; files.json was not available through the reader, and no excluded files were identified in the manifest.

To get this to a good state

Propagate the output failure state and add regression coverage for failure during padding and digit output. Re-run the target build and the two reported CTest cases on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6062603926 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24905#pullrequestreview-6062603926). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T18:06:52Z. **Review:** DISMISSED --- # Reviewed — changes requested Changes are required before merge: propagate output iterator failure state from the wide output helpers. ## What I ran Reviewed head `e113c15386da0a868f3d95a6c4cded6b71c19e61`. Read the prepared description, commits, diff, manifest, review README, and all changed source files through the pinned reader. No build or tests were run; the commands listed in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Found lost iterator failure state | | Build and tests | not run | Author-reported only | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/WideNumPutField.cpp:141`: `PutWideField` assigns the return of `LibcRepeatWideElement_nid_no_patch`, but that helper calls `PutWideElement` on a local iterator copy and returns the unchanged copy. A failed stream-buffer overflow therefore sets only a temporary iterator's `failed` flag. The same applies to the wide element helper at lines 145 and 152. `_Iput` can return an iterator that still reports success after output failure, contrary to the test's stated behavior. Update the helpers to propagate the failure flag (or write through an interface that mutates the caller's iterator), and cover failure during both padding and digit output. ### Non-blocking None. ## Not verified No build or tests were run in this review, and no behavior was checked on a physical console. The author reports a conventions check, target build, and two passing CTest cases. All eight changed files listed as reviewed in the manifest were read; `files.json` was not available through the reader, and no excluded files were identified in the manifest. ## To get this to a good state Propagate the output failure state and add regression coverage for failure during padding and digit output. Re-run the target build and the two reported CTest cases on the updated head.
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!24905
No description provided.