feat(libwebrtc): implement VideoFrameBuffer::CropAndScale on libyuv #26079

Closed
ToRaNek wants to merge 6 commits from upstream-pr/26079 into main
ToRaNek commented 2026-11-23 07:39:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ToRaNek on 2026-11-23T07:39:46Z.


What

webrtc::VideoFrameBuffer::CropAndScale was a stub in libwebrtc, although it sits in the virtual table of every buffer I420Buffer::Create makes. This implements it from api/video/video_frame_buffer.cc and I420Buffer::CropAndScaleFrom of api/video/i420_buffer.cc, at the commit the library already pins (M134, 8d78f5de):

  • the buffer is converted through its own ToI420 slot, so a guest buffer of another type is scaled from what it converts to, and that reference is released at the end;
  • the crop rectangle must lie inside the converted buffer, a negative height (libyuv's vertical flip) being measured by its magnitude; odd offsets are made even so that the chroma planes stay aligned;
  • an I420 buffer of the scaled size is created, with the strides of the two-argument Create (the width, and half the width rounded up);
  • the three planes are scaled by libyuv::I420Scale with the box filter.

Order and refusals. Upstream creates the destination first and checks afterwards, with RTC_CHECKs that abort. Here every argument is checked before anything is allocated, and the buffer is created last; for a call that succeeds the two orders give the same result. A refused call throws std::invalid_argument and leaves the result pointer, the reference counts and the heap as they were:

  • a scaled size that is not positive, or whose three planes do not fit in int (computed in 64 bits; the chroma stride is width / 2 + width % 2, which cannot overflow);
  • a crop size libyuv refuses: a width that is not positive, a height of zero, or either above 32768. Upstream lets these through, libyuv returns an error that a release build ignores, and the caller gets the new buffer unscaled; INT_MIN would also be negated inside libyuv before its own check;
  • a crop rectangle outside the converted buffer, a ToI420 that returns nothing, a null plane.

If libyuv itself fails after that (its only remaining reason is its own allocation), the new buffer is released and std::runtime_error is thrown.

libyuv. The scaler is upstream's own: 3rdparty/libyuv is a new submodule at 10592b60, the revision the DEPS file of that WebRTC commit pins. A webrtc_yuv static target in core/libs/CMakeLists.txt builds the ten sources the scaler needs and is linked privately into libwebrtc, next to fvad; the configuration stops with the git submodule update --init 3rdparty/libyuv instruction when the submodule is empty. Its LICENSE and PATENTS join the notices tools/package_release.py ships with libwebrtc.prx.

libyuv is built as upstream builds it, with its x86 rows chosen from the host CPU. I measured the alternative: on a Zen 2 host, a build limited to the C rows gives other pixels than the SSSE3 and AVX2 rows for the 3/4 and 3/8 ratios (1280x720 to 960x540 for one), and the same pixels for the other ratios I tried, so a C-only build would not follow the console's CPU on common sizes.

Recorded in the debt entry: the module's libyuv revision is unknown; a host without SSSE3 can differ by a rounding step; the refusals above.

Tested

Windows 11, MinGW GCC 15.2, Ryzen 5 3600. Not tested on a console. A reviewer built and ran the two test targets on Ubuntu 24.04 with GCC 13.3 at an earlier head.

  • New guest_webrtc_crop_and_scale test.
    • Same size: the planes are copied whatever the source strides, for five sizes including odd ones and 1x1.
    • Half and quarter size: every pixel equals the rounded mean of its 2x2 or 4x4 box, on the three planes, with and without a crop.
    • A third: every pixel follows libyuv's fixed-point box sum, (sum * (65536 / 9)) >> 16.
    • Three quarters: a checksum of the SSSE3 rows on pseudo-random planes, which the C rows do not produce.
    • Offsets: six pairs, odd ones read from the even position below, chroma from half of it.
    • A negative crop height flips the picture, as libyuv defines it, from the row offset too.
    • Uniform planes for fifteen ratios, up and down, stay uniform, or lose one step where libyuv's general box truncates.
    • A crop next to a bright column: no scaled value leaves the range of the cropped area, for six target sizes.
    • A guest buffer with its own table and a native type: ToI420 is called once, its result is read and released once; a guest I420 buffer with unusual strides; the same buffer with each plane null in turn.
    • The scaler's limits on a 40000-pixel-wide and a 40000-pixel-high buffer: 32768 is accepted on each axis, flipped too, and 32769 refused.
    • Refusals: null result, null buffer, null table, 31 crop rectangles (too wide, too high, negative offsets, sums that overflow int, flipped crops taller than what is left below the offset, zero and negative widths, zero heights, INT_MIN), 15 scaled sizes (zero, negative, INT_MAX and INT_MIN on each axis, sizes whose luma or chroma alone would fit), a null conversion. After each one the result pointer is untouched, no reference is left and the allocator was not called; on a guest buffer a refused size or crop size is reported before ToI420 is called.
  • It passed 5 runs in a row. guest_webrtc_i420_buffer_create_virtuals required the stub to throw; it now checks the buffer the slot returns. The 119 guest_webrtc tests pass.
  • python -m unittest tools.tests.test_package_release passes (140 tests), with the libyuv notices added to the WebRTC case.
  • Negative controls: 89 single changes of src/VideoFrameBufferCropAndScale.cpp, each rebuilt and run against the test: every table slot, each term and bound of the size, crop and rectangle checks, the 32768 limit on both sides, the 64-bit sums, the magnitude of a negative height, the rounding of the offsets and of the chroma stride, each null-plane test, the origin and the stride of each plane, the order of the planes and of the sizes on both sides of the scaler, the filter, each release. All 89 make the test fail. Not covered by a control: the branch taken when libyuv fails after the buffer exists, and the release of the buffer on that branch, which the test cannot reach. Two terms of upstream's rectangle check, crop_width <= width and crop_height <= height, follow from the others and are not repeated.
  • python tools/check_conventions.py --base origin/main, python tools/debt_fold.py --check and python core/libs/tests/test_public_headers.py --audit-only pass.

Not verified. I read no console module: the revision of libyuv it embeds and the rows it selects are not known. The failure of libyuv after the buffer is created cannot be provoked from the test.

Overlap (python tools/pr_overlap.py --branch feat/webrtc-video-frame-buffer-crop-and-scale):

The tool reports no conflicting file and no shared export, then ends with overlap check failed closed: 17 open PRs that conflict with main share .gitmodules (#1835), core/libs/CMakeLists.txt (#7275, #8650, #9156, #9293, #9297, #9302, #9383, #12642, #16793, #19542, #20315, #23786, #24322, #24917) or Export.cpp and Api.hpp of libwebrtc (#18498, #24668), so it cannot compare them. I compared each by hand (its diff against main on those files and on core/libs/prx/libwebrtc): none mentions libyuv, I420Scale or CropAndScale. python tools/pr_overlap.py --names on the symbol answers open: no matching PS5 export changes.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5449088871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079). Originally posted by [ToRaNek](https://github.com/ToRaNek) on 2026-11-23T07:39:46Z. --- ### What `webrtc::VideoFrameBuffer::CropAndScale` was a stub in `libwebrtc`, although it sits in the virtual table of every buffer `I420Buffer::Create` makes. This implements it from `api/video/video_frame_buffer.cc` and `I420Buffer::CropAndScaleFrom` of `api/video/i420_buffer.cc`, at the commit the library already pins ([M134, `8d78f5de`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/video/video_frame_buffer.cc)): - the buffer is converted through its own `ToI420` slot, so a guest buffer of another type is scaled from what it converts to, and that reference is released at the end; - the crop rectangle must lie inside the converted buffer, a negative height (libyuv's vertical flip) being measured by its magnitude; odd offsets are made even so that the chroma planes stay aligned; - an I420 buffer of the scaled size is created, with the strides of the two-argument `Create` (the width, and half the width rounded up); - the three planes are scaled by `libyuv::I420Scale` with the box filter. **Order and refusals.** Upstream creates the destination first and checks afterwards, with `RTC_CHECK`s that abort. Here every argument is checked before anything is allocated, and the buffer is created last; for a call that succeeds the two orders give the same result. A refused call throws `std::invalid_argument` and leaves the result pointer, the reference counts and the heap as they were: - a scaled size that is not positive, or whose three planes do not fit in `int` (computed in 64 bits; the chroma stride is `width / 2 + width % 2`, which cannot overflow); - a crop size libyuv refuses: a width that is not positive, a height of zero, or either above 32768. Upstream lets these through, libyuv returns an error that a release build ignores, and the caller gets the new buffer unscaled; `INT_MIN` would also be negated inside libyuv before its own check; - a crop rectangle outside the converted buffer, a `ToI420` that returns nothing, a null plane. If libyuv itself fails after that (its only remaining reason is its own allocation), the new buffer is released and `std::runtime_error` is thrown. **libyuv.** The scaler is upstream's own: `3rdparty/libyuv` is a new submodule at `10592b60`, the revision the `DEPS` file of that WebRTC commit pins. A `webrtc_yuv` static target in `core/libs/CMakeLists.txt` builds the ten sources the scaler needs and is linked privately into `libwebrtc`, next to `fvad`; the configuration stops with the `git submodule update --init 3rdparty/libyuv` instruction when the submodule is empty. Its `LICENSE` and `PATENTS` join the notices `tools/package_release.py` ships with `libwebrtc.prx`. libyuv is built as upstream builds it, with its x86 rows chosen from the host CPU. I measured the alternative: on a Zen 2 host, a build limited to the C rows gives other pixels than the SSSE3 and AVX2 rows for the 3/4 and 3/8 ratios (1280x720 to 960x540 for one), and the same pixels for the other ratios I tried, so a C-only build would not follow the console's CPU on common sizes. Recorded in the debt entry: the module's libyuv revision is unknown; a host without SSSE3 can differ by a rounding step; the refusals above. ### Tested Windows 11, MinGW GCC 15.2, Ryzen 5 3600. Not tested on a console. A reviewer built and ran the two test targets on Ubuntu 24.04 with GCC 13.3 at an earlier head. - New `guest_webrtc_crop_and_scale` test. - Same size: the planes are copied whatever the source strides, for five sizes including odd ones and 1x1. - Half and quarter size: every pixel equals the rounded mean of its 2x2 or 4x4 box, on the three planes, with and without a crop. - A third: every pixel follows libyuv's fixed-point box sum, `(sum * (65536 / 9)) >> 16`. - Three quarters: a checksum of the SSSE3 rows on pseudo-random planes, which the C rows do not produce. - Offsets: six pairs, odd ones read from the even position below, chroma from half of it. - A negative crop height flips the picture, as libyuv defines it, from the row offset too. - Uniform planes for fifteen ratios, up and down, stay uniform, or lose one step where libyuv's general box truncates. - A crop next to a bright column: no scaled value leaves the range of the cropped area, for six target sizes. - A guest buffer with its own table and a native type: `ToI420` is called once, its result is read and released once; a guest I420 buffer with unusual strides; the same buffer with each plane null in turn. - The scaler's limits on a 40000-pixel-wide and a 40000-pixel-high buffer: 32768 is accepted on each axis, flipped too, and 32769 refused. - Refusals: null result, null buffer, null table, 31 crop rectangles (too wide, too high, negative offsets, sums that overflow `int`, flipped crops taller than what is left below the offset, zero and negative widths, zero heights, `INT_MIN`), 15 scaled sizes (zero, negative, `INT_MAX` and `INT_MIN` on each axis, sizes whose luma or chroma alone would fit), a null conversion. After each one the result pointer is untouched, no reference is left and the allocator was not called; on a guest buffer a refused size or crop size is reported before `ToI420` is called. - It passed 5 runs in a row. `guest_webrtc_i420_buffer_create_virtuals` required the stub to throw; it now checks the buffer the slot returns. The 119 `guest_webrtc` tests pass. - `python -m unittest tools.tests.test_package_release` passes (140 tests), with the libyuv notices added to the WebRTC case. - Negative controls: 89 single changes of `src/VideoFrameBufferCropAndScale.cpp`, each rebuilt and run against the test: every table slot, each term and bound of the size, crop and rectangle checks, the 32768 limit on both sides, the 64-bit sums, the magnitude of a negative height, the rounding of the offsets and of the chroma stride, each null-plane test, the origin and the stride of each plane, the order of the planes and of the sizes on both sides of the scaler, the filter, each release. All 89 make the test fail. Not covered by a control: the branch taken when libyuv fails after the buffer exists, and the release of the buffer on that branch, which the test cannot reach. Two terms of upstream's rectangle check, `crop_width <= width` and `crop_height <= height`, follow from the others and are not repeated. - `python tools/check_conventions.py --base origin/main`, `python tools/debt_fold.py --check` and `python core/libs/tests/test_public_headers.py --audit-only` pass. **Not verified.** I read no console module: the revision of libyuv it embeds and the rows it selects are not known. The failure of libyuv after the buffer is created cannot be provoked from the test. **Overlap** (`python tools/pr_overlap.py --branch feat/webrtc-video-frame-buffer-crop-and-scale`): The tool reports no conflicting file and no shared export, then ends with `overlap check failed closed`: 17 open PRs that conflict with `main` share `.gitmodules` (#1835), `core/libs/CMakeLists.txt` (#7275, #8650, #9156, #9293, #9297, #9302, #9383, #12642, #16793, #19542, #20315, #23786, #24322, #24917) or `Export.cpp` and `Api.hpp` of `libwebrtc` (#18498, #24668), so it cannot compare them. I compared each by hand (its diff against `main` on those files and on `core/libs/prx/libwebrtc`): none mentions libyuv, `I420Scale` or `CropAndScale`. `python tools/pr_overlap.py --names` on the symbol answers `open: no matching PS5 export changes`. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [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-23 07:41:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-23T07:41:32Z.

Review: CHANGES_REQUESTED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: CMakeLists.txt failed to build.
    -- Configuring done (4.6s)
    CMake Error at core/libs/CMakeLists.txt:244 (add_library):
      Cannot find source file:
    
        3rdparty/libyuv/source/cpu_id.cc
    
    
    CMake Error at core/libs/CMakeLists.txt:244 (add_library):
      No SOURCES given to target: webrtc_yuv
    
    
    CMake Generate step failed.  Build files cannot be regenerated correctly.
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017983951 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6017983951). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-23T07:41:32Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `b205cff00c`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `CMakeLists.txt` failed to build. ``` -- Configuring done (4.6s) CMake Error at core/libs/CMakeLists.txt:244 (add_library): Cannot find source file: 3rdparty/libyuv/source/cpu_id.cc CMake Error at core/libs/CMakeLists.txt:244 (add_library): No SOURCES given to target: webrtc_yuv CMake Generate step failed. Build files cannot be regenerated correctly. ``` Requesting changes for the points above.
mihiii1337 commented 2026-11-23 07:51:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T07:51:07Z.

Review: CHANGES_REQUESTED


The crop rectangle guard uses the signed cropHeight, but negative heights are intentionally accepted and libyuv immediately negates them to obtain the row count before scaling. An inverted crop whose magnitude extends past the bottom of the source can therefore pass the current check even though the scaler consumes more rows than the validated rectangle.

Please validate offsetY + magnitude(cropHeight) in a wide integer before any plane-pointer calculation or scaler call, while preserving the original signed height when calling libyuv so valid vertical inversion still works. The regression should prove that a valid inverted crop reaches the scaler, while an oversized inverted extent throws the existing invalid_argument with the result/reference state unchanged and no scaler invocation.

Verification at b205cff00c49eeb1e4390d4e57383efa8d39e260 was deliberately memory-safe: a fail-closed scaler stand-in counted dispatches and never read image planes. The exact PR guard forwarded both the valid inverted crop and the oversized extent (exit 7); the magnitude-based control forwarded only the valid case (exit 0). Pinned libyuv's ScalePlane confirms the negative-height inversion, and the targeted pinned-libyuv build plus existing positive pixel subset passed. I did not execute an out-of-bounds read. The full standalone suite was not claimed because the reused older libc hit an unwind limitation. Conventions and merge preview passed; hosted release-tools and portability checks are green, with Windows still running. No GPU test was run.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018087310 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018087310). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T07:51:07Z. **Review:** CHANGES_REQUESTED --- The crop rectangle guard uses the signed `cropHeight`, but negative heights are intentionally accepted and libyuv immediately negates them to obtain the row count before scaling. An inverted crop whose magnitude extends past the bottom of the source can therefore pass the current check even though the scaler consumes more rows than the validated rectangle. Please validate `offsetY + magnitude(cropHeight)` in a wide integer before any plane-pointer calculation or scaler call, while preserving the original signed height when calling libyuv so valid vertical inversion still works. The regression should prove that a valid inverted crop reaches the scaler, while an oversized inverted extent throws the existing `invalid_argument` with the result/reference state unchanged and no scaler invocation. Verification at `b205cff00c49eeb1e4390d4e57383efa8d39e260` was deliberately memory-safe: a fail-closed scaler stand-in counted dispatches and never read image planes. The exact PR guard forwarded both the valid inverted crop and the oversized extent (exit 7); the magnitude-based control forwarded only the valid case (exit 0). Pinned libyuv's `ScalePlane` confirms the negative-height inversion, and the targeted pinned-libyuv build plus existing positive pixel subset passed. I did not execute an out-of-bounds read. The full standalone suite was not claimed because the reused older libc hit an unwind limitation. Conventions and merge preview passed; hosted release-tools and portability checks are green, with Windows still running. No GPU test was run. AI-assisted: yes.
MarcZX10 commented 2026-11-23 07:59:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T07:59:10Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: reject invalid crop dimensions before using them to create the destination buffer.

What I ran

Reviewed head b205cff00c49eeb1e4390d4e57383efa8d39e260 and the prepared diff. No build or tests were run.

Results

Check Result Note
Source review passed Implementation and targeted callers inspected
Build and tests not run Author reports results; not independently run

Findings

Blocking

  • core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:105: The destination is created before validating the crop. In particular, cropHeight == INT_MIN passes the current upper-bound and negative-offset checks, but libyuv negates negative source height when setting up vertical scaling; negating INT_MIN overflows. This can invoke undefined behavior for an input the implementation otherwise accepts. Validate crop dimensions before destination creation, rejecting INT_MIN (and any other unsupported dimension) while preserving intentionally supported negative-height flips.

Non-blocking

None.

Not verified

The submodule entry is present, but its checkout contents were excluded because it is not plain text; its source files, LICENSE, and PATENTS were not inspected. Console behavior and the author-reported build and test runs were not independently verified. The remaining changed files listed in the manifest were not read: core/libs/prx/libwebrtc/tests/VideoFrameBufferCropAndScale.cpp, core/libs/prx/libwebrtc/Export.cpp, and core/libs/prx/libwebrtc/include/Api.hpp were partially reviewed through the diff where relevant; other changed-file text and tests were not fully verified.

To get this to a good state

Reject the INT_MIN crop height before destination creation and add a regression test that confirms it is refused without allocation or changing the result pointer. Then rerun the crop-and-scale and library test suites.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018173592 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018173592). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T07:59:10Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: reject invalid crop dimensions before using them to create the destination buffer. ## What I ran Reviewed head `b205cff00c49eeb1e4390d4e57383efa8d39e260` and the prepared diff. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Implementation and targeted callers inspected | | Build and tests | not run | Author reports results; not independently run | ## Findings ### Blocking - `core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:105`: The destination is created before validating the crop. In particular, `cropHeight == INT_MIN` passes the current upper-bound and negative-offset checks, but libyuv negates negative source height when setting up vertical scaling; negating `INT_MIN` overflows. This can invoke undefined behavior for an input the implementation otherwise accepts. Validate crop dimensions before destination creation, rejecting `INT_MIN` (and any other unsupported dimension) while preserving intentionally supported negative-height flips. ### Non-blocking None. ## Not verified The submodule entry is present, but its checkout contents were excluded because it is not plain text; its source files, `LICENSE`, and `PATENTS` were not inspected. Console behavior and the author-reported build and test runs were not independently verified. The remaining changed files listed in the manifest were not read: `core/libs/prx/libwebrtc/tests/VideoFrameBufferCropAndScale.cpp`, `core/libs/prx/libwebrtc/Export.cpp`, and `core/libs/prx/libwebrtc/include/Api.hpp` were partially reviewed through the diff where relevant; other changed-file text and tests were not fully verified. ## To get this to a good state Reject the `INT_MIN` crop height before destination creation and add a regression test that confirms it is refused without allocation or changing the result pointer. Then rerun the crop-and-scale and library test suites.
PrivacyOnion commented 2026-11-23 08:28:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-23T08:28:04Z.

Review: CHANGES_REQUESTED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: CMakeLists.txt failed to build.
    -- Building with GNU 13.3.0 on Linux-6.8.0-71-generic
    -- Performing Test COMPILER_SUPPORTS_Wformat=2
    -- Performing Test COMPILER_SUPPORTS_Wformat=2 - Success
    --   QJS_BUILD_LIBC: OFF
    -- USING O3
    CMake Error at core/libs/CMakeLists.txt:245 (message):
      libyuv: 3rdparty/libyuv/source/scale.cc is
      missing; initialize the submodule with git submodule update --init
      3rdparty/libyuv
    
    
    -- Configuring incomplete, errors occurred!
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018512774 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018512774). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-23T08:28:04Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `7f04c46d8e`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `CMakeLists.txt` failed to build. ``` -- Building with GNU 13.3.0 on Linux-6.8.0-71-generic -- Performing Test COMPILER_SUPPORTS_Wformat=2 -- Performing Test COMPILER_SUPPORTS_Wformat=2 - Success -- QJS_BUILD_LIBC: OFF -- USING O3 CMake Error at core/libs/CMakeLists.txt:245 (message): libyuv: 3rdparty/libyuv/source/scale.cc is missing; initialize the submodule with git submodule update --init 3rdparty/libyuv -- Configuring incomplete, errors occurred! ``` Requesting changes for the points above.
mihiii1337 commented 2026-11-23 08:33:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T08:33:49Z.

Review: APPROVED


Re-reviewed fix head 7f04c46d8e08e1ed9cf0be31dd999cd5c494e559. This resolves my negative-height boundary finding. The implementation promotes cropHeight to int64_t before negation, validates magnitude + offsetY against the converted I420 source height before any plane offset or I420Scale, and preserves the original signed height when calling libyuv so valid vertical inversion still works (including the INT_MIN conversion boundary).

The positive inverted-window fixture reads all three Y/U/V planes backward. Eight refusal cases now verify invalid_argument, unchanged result pointer/reference count and allocation balance; three accepted boundary controls remain. The result is assigned only after a successful scale, and temporary RAII references unwind on rejection.

The pinned libyuv Gitlink is unchanged and the official remote contains the required scale/cpu/header sources at that exact commit. The reported Linux configure failure was a locally uninitialized submodule, not a compiler result. The prior exact-topic Windows job built the libyuv objects and ran guest_webrtc_crop_and_scale successfully; new portability/release-tools checks are green and the replacement workflow is starting. I deliberately did not execute any out-of-bounds access or GPU test.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018573346 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018573346). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T08:33:49Z. **Review:** APPROVED --- Re-reviewed fix head `7f04c46d8e08e1ed9cf0be31dd999cd5c494e559`. This resolves my negative-height boundary finding. The implementation promotes `cropHeight` to `int64_t` before negation, validates `magnitude + offsetY` against the converted I420 source height before any plane offset or `I420Scale`, and preserves the original signed height when calling libyuv so valid vertical inversion still works (including the `INT_MIN` conversion boundary). The positive inverted-window fixture reads all three Y/U/V planes backward. Eight refusal cases now verify `invalid_argument`, unchanged result pointer/reference count and allocation balance; three accepted boundary controls remain. The result is assigned only after a successful scale, and temporary RAII references unwind on rejection. The pinned libyuv Gitlink is unchanged and the official remote contains the required scale/cpu/header sources at that exact commit. The reported Linux configure failure was a locally uninitialized submodule, not a compiler result. The prior exact-topic Windows job built the libyuv objects and ran `guest_webrtc_crop_and_scale` successfully; new portability/release-tools checks are green and the replacement workflow is starting. I deliberately did not execute any out-of-bounds access or GPU test. AI-assisted: yes.
mihiii1337 commented 2026-11-23 08:34:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T08:34:23Z.

Review: CHANGES_REQUESTED


I need to supersede my approval after the continuing boundary audit found one separate blocker in the same input-validation path. The negative cropHeight issue is fixed, but the destination chroma stride is still computed as (scaledWidth + 1) / 2 in signed int before I420Buffer::Create validates dimensions. For a valid int input of INT_MAX, the addition itself overflows; the later size/dimension rejection cannot make that expression defined.

Please validate the destination dimensions before deriving strides and compute the ceil-half width without signed overflow (for example in int64_t, with a checked conversion, or scaledWidth / 2 + scaledWidth % 2 after proving it positive). Add a boundary regression showing the largest input is rejected deterministically with the result pointer/reference/allocation state unchanged and no allocator/scaler call.

This is a source-level arithmetic finding at VideoFrameBufferCropAndScale.cpp:105; I did not execute the undefined expression or any out-of-bounds access. The prior review's evidence for the corrected inverted-crop extent remains valid and does not need to be redone.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018578799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018578799). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T08:34:23Z. **Review:** CHANGES_REQUESTED --- I need to supersede my approval after the continuing boundary audit found one separate blocker in the same input-validation path. The negative `cropHeight` issue is fixed, but the destination chroma stride is still computed as `(scaledWidth + 1) / 2` in signed `int` before `I420Buffer::Create` validates dimensions. For a valid `int` input of `INT_MAX`, the addition itself overflows; the later size/dimension rejection cannot make that expression defined. Please validate the destination dimensions before deriving strides and compute the ceil-half width without signed overflow (for example in `int64_t`, with a checked conversion, or `scaledWidth / 2 + scaledWidth % 2` after proving it positive). Add a boundary regression showing the largest input is rejected deterministically with the result pointer/reference/allocation state unchanged and no allocator/scaler call. This is a source-level arithmetic finding at `VideoFrameBufferCropAndScale.cpp:105`; I did not execute the undefined expression or any out-of-bounds access. The prior review's evidence for the corrected inverted-crop extent remains valid and does not need to be redone. AI-assisted: yes.
MarcZX10 commented 2026-11-23 08:42:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T08:42:03Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 7f04c46d8e08e1ed9cf0be31dd999cd5c494e559 against main using the prepared diff and repo_read.py. No commands or tests were run independently.

Results

Check Result Note
Source review passed Implementation, build wiring, tests, and packaging changes inspected
Tests not run Results in the description are author-reported
Submodule contents not run Gitlink is visible; target contents were unavailable as text

Negative control

Not run independently. The description reports 65 single-change negative controls, each failing the new test.

Findings

Blocking

None.

Non-blocking

  • Console behavior and the console’s libyuv revision remain unverified, as recorded in the change’s debt entry.

Sources

Reviewed the prepared diff and changed source at the pinned head, including core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp, core/libs/CMakeLists.txt, core/libs/prx/libwebrtc/CMakeLists.txt, and the changed tests and release packaging code.

Not verified

  • 3rdparty/libyuv is a changed gitlink and its checked-out contents were unavailable as text; only its pinned commit shown in the diff was reviewed.
  • Tests and build checks were not run independently. Linux, macOS, and console behavior were not verified.

To get this to a good state

Nothing is required. Optional: verify the pinned submodule contents and console behavior when available.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018655744 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018655744). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T08:42:03Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the points below are optional. ## What I ran Reviewed head `7f04c46d8e08e1ed9cf0be31dd999cd5c494e559` against `main` using the prepared diff and `repo_read.py`. No commands or tests were run independently. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Implementation, build wiring, tests, and packaging changes inspected | | Tests | not run | Results in the description are author-reported | | Submodule contents | not run | Gitlink is visible; target contents were unavailable as text | ## Negative control Not run independently. The description reports 65 single-change negative controls, each failing the new test. ## Findings ### Blocking None. ### Non-blocking - Console behavior and the console’s libyuv revision remain unverified, as recorded in the change’s debt entry. ## Sources Reviewed the prepared diff and changed source at the pinned head, including `core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp`, `core/libs/CMakeLists.txt`, `core/libs/prx/libwebrtc/CMakeLists.txt`, and the changed tests and release packaging code. ## Not verified - `3rdparty/libyuv` is a changed gitlink and its checked-out contents were unavailable as text; only its pinned commit shown in the diff was reviewed. - Tests and build checks were not run independently. Linux, macOS, and console behavior were not verified. ## To get this to a good state Nothing is required. Optional: verify the pinned submodule contents and console behavior when available.
mihiii1337 commented 2026-11-23 08:53:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T08:53:22Z.

Review: CHANGES_REQUESTED


Re-reviewed exact head 9e711745aed1a8dc7101bfd642da9e8a9f0dd201. The new ceil-half expression is defined for every int, but the requested validation order is not fixed yet: line 106 still enters I420Buffer::Create before validating either the destination dimensions or the source rectangle. Create allocates the ref-counted object shell before I420DataSize rejects the dimensions, so the current allocation-balance assertion does not establish the maintainer-requested zero allocator call; the boundary cases also still expect runtime_error rather than the requested invalid_argument.

Continuing the same source-only boundary audit found one separate lower-bound gap at line 114, described inline. Please validate the destination dimensions/size before Create, and reject non-positive crop widths before plane calculation or scaler dispatch. A fail-closed scaler/allocator counter can cover both without executing an invalid expression.

I inspected the exact PR source, I420Buffer::Create, the test fixture, and pinned libyuv scale.cc. I did not execute undefined arithmetic, an out-of-bounds access, or a GPU test.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018777143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018777143). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T08:53:22Z. **Review:** CHANGES_REQUESTED --- Re-reviewed exact head `9e711745aed1a8dc7101bfd642da9e8a9f0dd201`. The new ceil-half expression is defined for every `int`, but the requested validation order is not fixed yet: line 106 still enters `I420Buffer::Create` before validating either the destination dimensions or the source rectangle. `Create` allocates the ref-counted object shell before `I420DataSize` rejects the dimensions, so the current allocation-balance assertion does not establish the maintainer-requested zero allocator call; the boundary cases also still expect `runtime_error` rather than the requested `invalid_argument`. Continuing the same source-only boundary audit found one separate lower-bound gap at line 114, described inline. Please validate the destination dimensions/size before `Create`, and reject non-positive crop widths before plane calculation or scaler dispatch. A fail-closed scaler/allocator counter can cover both without executing an invalid expression. I inspected the exact PR source, `I420Buffer::Create`, the test fixture, and pinned libyuv `scale.cc`. I did not execute undefined arithmetic, an out-of-bounds access, or a GPU test. AI-assisted: yes.
MarcZX10 commented 2026-11-23 08:56:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T08:56:06Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the implementation and its changed call sites are supported by the inspected code, with the libyuv submodule contents and console behavior not verified.

What I ran

Reviewed head 9e711745aed1a8dc7101bfd642da9e8a9f0dd201 using the prepared diff and repository reader. No build or tests were run during this review; results reported in the PR description are author-reported.

Results

Check Result Note
Changed implementation and integration passed Inspected the implementation, build wiring, export, and tests
Build and tests in this review not run PR description reports successful runs
libyuv submodule and console behavior not run Submodule content is unavailable in the review materials

Findings

Blocking

None.

Non-blocking

None.

Not verified

The changed text files were read, including the implementation, tests, build and packaging changes, debt entry, and .gitmodules. The 3rdparty/libyuv submodule pointer was present in the diff, but its checked-out source and license files were excluded as unsupported; their contents were not verified. No tests were run during this review, and no console behavior was verified. The PR description reports Windows/MinGW test runs and explicitly says console behavior is untested.

To get this to a good state

Nothing is required.

Sources

The changed implementation and its associated tests are in VideoFrameBufferCropAndScale.cpp at the reviewed commit and its test at the reviewed commit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018811105 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018811105). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T08:56:06Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the implementation and its changed call sites are supported by the inspected code, with the libyuv submodule contents and console behavior not verified. ## What I ran Reviewed head `9e711745aed1a8dc7101bfd642da9e8a9f0dd201` using the prepared diff and repository reader. No build or tests were run during this review; results reported in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed implementation and integration | passed | Inspected the implementation, build wiring, export, and tests | | Build and tests in this review | not run | PR description reports successful runs | | libyuv submodule and console behavior | not run | Submodule content is unavailable in the review materials | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The changed text files were read, including the implementation, tests, build and packaging changes, debt entry, and `.gitmodules`. The `3rdparty/libyuv` submodule pointer was present in the diff, but its checked-out source and license files were excluded as unsupported; their contents were not verified. No tests were run during this review, and no console behavior was verified. The PR description reports Windows/MinGW test runs and explicitly says console behavior is untested. ## To get this to a good state Nothing is required. ## Sources The changed implementation and its associated tests are in [VideoFrameBufferCropAndScale.cpp at the reviewed commit](https://github.com/boykopovar/AnyPS5/blob/9e711745aed1a8dc7101bfd642da9e8a9f0dd201/core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp) and [its test at the reviewed commit](https://github.com/boykopovar/AnyPS5/blob/9e711745aed1a8dc7101bfd642da9e8a9f0dd201/core/libs/prx/libwebrtc/tests/VideoFrameBufferCropAndScale.cpp).
PrivacyOnion commented 2026-11-23 09:03:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-23T09:03:42Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_webrtc_crop_and_scale_tests, guest_webrtc_i420_buffer_create_tests built cleanly.
  • CTest (guest_webrtc_i420_buffer_create_create, guest_webrtc_i420_buffer_create_virtuals, guest_webrtc_i420_buffer_create_invalid, guest_webrtc_crop_and_scale):
    1/4 Test #6363: guest_webrtc_i420_buffer_create_virtuals ...   Passed    0.03 sec
    2/4 Test #6362: guest_webrtc_i420_buffer_create_create .....   Passed    0.04 sec
    3/4 Test #6364: guest_webrtc_i420_buffer_create_invalid ....   Passed    0.03 sec
    4/4 Test #6365: guest_webrtc_crop_and_scale ................   Passed    0.07 sec
    100% tests passed, 0 tests failed out of 4
    
  • Negative control: with core/libs/prx/libwebrtc/Export.cpp, core/libs/prx/libwebrtc/include/Api.hpp, core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp reverted to main and the new tests kept, the suite fails:
    1/4 Test #6365: guest_webrtc_crop_and_scale ................***Failed    0.02 sec
    2/4 Test #6362: guest_webrtc_i420_buffer_create_create .....   Passed    0.04 sec
    3/4 Test #6364: guest_webrtc_i420_buffer_create_invalid ....   Passed    0.05 sec
    4/4 Test #6363: guest_webrtc_i420_buffer_create_virtuals ...***Failed    0.03 sec
    50% tests passed, 2 tests failed out of 4
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified VideoFrameBufferCropAndScale.cpp:108-118 crop rectangle validation: checks offsetX < 0, offsetY < 0, int64_t(cropWidth) + offsetX > sourceWidth, and rows + offsetY > sourceHeight with rows = (cropHeight < 0 ? -int64_t(cropHeight) : int64_t(cropHeight)), properly handling INT_MIN and signed negative heights.
    • Verified VideoFrameBufferCropAndScale.cpp:104 chromaStride computation scaledWidth / 2 + scaledWidth % 2 to prevent integer overflow for INT_MAX.
    • Verified VideoFrameBufferCropAndScale.cpp:103-107 I420Buffer::Create allocation lifecycle and RAII target/source cleanup with Reference struct releasing COM-style refcount on exception or error.
    • Verified VideoFrameBufferCropAndScale.cpp:119-122 chroma offset alignment uvOffsetX = offsetX / 2; uvOffsetY = offsetY / 2; offsetX = uvOffsetX * 2; offsetY = uvOffsetY * 2 matching upstream WebRTC CropAndScaleFrom.
    • Verified CMakeLists.txt and .gitmodules submodule integration for 3rdparty/libyuv at pinned revision 10592b60 matching WebRTC M134 DEPS and package_release.py license packaging.
    • Verified AGENTS.md compliance, license headers, technical debt fragment in docs/dev/debt/changes/, and comprehensive test coverage in VideoFrameBufferCropAndScale.cpp.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018903382 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6018903382). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-23T09:03:42Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `9e711745ae`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_webrtc_crop_and_scale_tests`, `guest_webrtc_i420_buffer_create_tests` built cleanly. - **CTest** (`guest_webrtc_i420_buffer_create_create`, `guest_webrtc_i420_buffer_create_virtuals`, `guest_webrtc_i420_buffer_create_invalid`, `guest_webrtc_crop_and_scale`): ``` 1/4 Test #6363: guest_webrtc_i420_buffer_create_virtuals ... Passed 0.03 sec 2/4 Test #6362: guest_webrtc_i420_buffer_create_create ..... Passed 0.04 sec 3/4 Test #6364: guest_webrtc_i420_buffer_create_invalid .... Passed 0.03 sec 4/4 Test #6365: guest_webrtc_crop_and_scale ................ Passed 0.07 sec 100% tests passed, 0 tests failed out of 4 ``` - **Negative control**: with `core/libs/prx/libwebrtc/Export.cpp`, `core/libs/prx/libwebrtc/include/Api.hpp`, `core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/4 Test #6365: guest_webrtc_crop_and_scale ................***Failed 0.02 sec 2/4 Test #6362: guest_webrtc_i420_buffer_create_create ..... Passed 0.04 sec 3/4 Test #6364: guest_webrtc_i420_buffer_create_invalid .... Passed 0.05 sec 4/4 Test #6363: guest_webrtc_i420_buffer_create_virtuals ...***Failed 0.03 sec 50% tests passed, 2 tests failed out of 4 ``` Restoring the change makes it pass again. - **Code reading**: - Verified VideoFrameBufferCropAndScale.cpp:108-118 crop rectangle validation: checks offsetX < 0, offsetY < 0, int64_t(cropWidth) + offsetX > sourceWidth, and rows + offsetY > sourceHeight with rows = (cropHeight < 0 ? -int64_t(cropHeight) : int64_t(cropHeight)), properly handling INT_MIN and signed negative heights. - Verified VideoFrameBufferCropAndScale.cpp:104 chromaStride computation scaledWidth / 2 + scaledWidth % 2 to prevent integer overflow for INT_MAX. - Verified VideoFrameBufferCropAndScale.cpp:103-107 I420Buffer::Create allocation lifecycle and RAII target/source cleanup with Reference struct releasing COM-style refcount on exception or error. - Verified VideoFrameBufferCropAndScale.cpp:119-122 chroma offset alignment uvOffsetX = offsetX / 2; uvOffsetY = offsetY / 2; offsetX = uvOffsetX * 2; offsetY = uvOffsetY * 2 matching upstream WebRTC CropAndScaleFrom. - Verified CMakeLists.txt and .gitmodules submodule integration for 3rdparty/libyuv at pinned revision 10592b60 matching WebRTC M134 DEPS and package_release.py license packaging. - Verified AGENTS.md compliance, license headers, technical debt fragment in docs/dev/debt/changes/, and comprehensive test coverage in VideoFrameBufferCropAndScale.cpp. Looks Good To Me
PrivacyOnion commented 2026-11-23 10:34:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-23T10:34:58Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_webrtc_crop_and_scale_tests, guest_webrtc_i420_buffer_create_tests built cleanly.
  • CTest (guest_webrtc_i420_buffer_create_create, guest_webrtc_i420_buffer_create_virtuals, guest_webrtc_i420_buffer_create_invalid, guest_webrtc_crop_and_scale):
    1/4 Test #6367: guest_webrtc_i420_buffer_create_create .....   Passed    0.05 sec
    2/4 Test #6370: guest_webrtc_crop_and_scale ................   Passed    0.08 sec
    3/4 Test #6369: guest_webrtc_i420_buffer_create_invalid ....   Passed    0.03 sec
    4/4 Test #6368: guest_webrtc_i420_buffer_create_virtuals ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 4
    
  • Negative control: with core/libs/prx/libwebrtc/Export.cpp, core/libs/prx/libwebrtc/include/Api.hpp, core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp reverted to main and the new tests kept, the suite fails:
    1/4 Test #6370: guest_webrtc_crop_and_scale ................***Failed    0.02 sec
    2/4 Test #6367: guest_webrtc_i420_buffer_create_create .....   Passed    0.05 sec
    3/4 Test #6369: guest_webrtc_i420_buffer_create_invalid ....   Passed    0.05 sec
    4/4 Test #6368: guest_webrtc_i420_buffer_create_virtuals ...***Failed    0.03 sec
    50% tests passed, 2 tests failed out of 4
    
    Restoring the change makes it pass again.
  • Code reading:
    • Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:103-108 parameter and dimension validation for result, buffer, vtable, scaledWidth/scaledHeight <= 0, and 64-bit plane overflow guard against INT_MAX
    • Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:109-111 scaler limits against cropWidth <= 0, rows == 0 (cropHeight == 0), cropWidth > 32768, rows > 32768, and negative height rows computation handling INT_MIN safely without signed overflow
    • Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:112-127 ToI420 conversion, source bounds checking (cropWidth + offsetX > sourceWidth, rows + offsetY > sourceHeight, negative offsets), even offset chroma plane alignment, and null plane pointer checks
    • Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:138-149 libyuv::I420Scale invocation return code check, RAII reference management via struct Reference preventing leaks on thrown exceptions, and result publishing only on success
    • Checked CMakeLists.txt, .gitmodules, docs/dev/debt/changes fragment, and package_release.py license packaging for compliance with AGENTS.md conventions

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6020073992 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6020073992). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-23T10:34:58Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `d3a8483c27`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_webrtc_crop_and_scale_tests`, `guest_webrtc_i420_buffer_create_tests` built cleanly. - **CTest** (`guest_webrtc_i420_buffer_create_create`, `guest_webrtc_i420_buffer_create_virtuals`, `guest_webrtc_i420_buffer_create_invalid`, `guest_webrtc_crop_and_scale`): ``` 1/4 Test #6367: guest_webrtc_i420_buffer_create_create ..... Passed 0.05 sec 2/4 Test #6370: guest_webrtc_crop_and_scale ................ Passed 0.08 sec 3/4 Test #6369: guest_webrtc_i420_buffer_create_invalid .... Passed 0.03 sec 4/4 Test #6368: guest_webrtc_i420_buffer_create_virtuals ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 4 ``` - **Negative control**: with `core/libs/prx/libwebrtc/Export.cpp`, `core/libs/prx/libwebrtc/include/Api.hpp`, `core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/4 Test #6370: guest_webrtc_crop_and_scale ................***Failed 0.02 sec 2/4 Test #6367: guest_webrtc_i420_buffer_create_create ..... Passed 0.05 sec 3/4 Test #6369: guest_webrtc_i420_buffer_create_invalid .... Passed 0.05 sec 4/4 Test #6368: guest_webrtc_i420_buffer_create_virtuals ...***Failed 0.03 sec 50% tests passed, 2 tests failed out of 4 ``` Restoring the change makes it pass again. - **Code reading**: - Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:103-108 parameter and dimension validation for result, buffer, vtable, scaledWidth/scaledHeight <= 0, and 64-bit plane overflow guard against INT_MAX - Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:109-111 scaler limits against cropWidth <= 0, rows == 0 (cropHeight == 0), cropWidth > 32768, rows > 32768, and negative height rows computation handling INT_MIN safely without signed overflow - Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:112-127 ToI420 conversion, source bounds checking (cropWidth + offsetX > sourceWidth, rows + offsetY > sourceHeight, negative offsets), even offset chroma plane alignment, and null plane pointer checks - Checked core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp:138-149 libyuv::I420Scale invocation return code check, RAII reference management via struct Reference preventing leaks on thrown exceptions, and result publishing only on success - Checked CMakeLists.txt, .gitmodules, docs/dev/debt/changes fragment, and package_release.py license packaging for compliance with AGENTS.md conventions Looks Good To Me
MarcZX10 commented 2026-11-23 10:42:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T10:42:28Z.

Review: COMMENTED


Reviewed — no blocking findings

The changed implementation and build/package integration were inspected at head d3a8483c274de7c7bdbf2fdb16568658d736170f; no concrete blocking defect was verified, but tests were not run and the libyuv submodule contents were unavailable for review.

What I ran

No commands or tests were run. I read the prepared description, commits, diff, manifest, review README, and targeted source ranges at the pinned head. The changed files inspected were .gitmodules, 3rdparty/libyuv (submodule pointer only), core/libs/CMakeLists.txt, core/libs/prx/libwebrtc/CMakeLists.txt, core/libs/prx/libwebrtc/Export.cpp, core/libs/prx/libwebrtc/include/Api.hpp, core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp, core/libs/prx/libwebrtc/src/I420Buffer.cpp, core/libs/prx/libwebrtc/tests/I420BufferCreate.cpp (diff), core/libs/prx/libwebrtc/tests/VideoFrameBufferCropAndScale.cpp (diff and selected ranges), docs/dev/debt/changes/feat-webrtc-video-frame-buffer-crop-and-scale.md, tools/package_release.py, and tools/tests/test_package_release.py (diff). 3rdparty/libyuv was excluded because its text was unavailable.

Results

Check Result Note
Source review passed No verified blocking defect
Tests not run Author-reported results were not rerun
Submodule review not run Pointer inspected; contents unavailable

Findings

Blocking

None verified.

Non-blocking

No additional comments.

Not verified

The libyuv source and license files at the submodule revision, console behavior, and author-reported build and test results were not independently verified. Some changed test-file ranges were not read in full.

To get this to a good state

Nothing is required. The implementation has extensive author-reported tests, but those results were not rerun during this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6020194174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6020194174). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T10:42:28Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The changed implementation and build/package integration were inspected at head `d3a8483c274de7c7bdbf2fdb16568658d736170f`; no concrete blocking defect was verified, but tests were not run and the libyuv submodule contents were unavailable for review. ## What I ran No commands or tests were run. I read the prepared description, commits, diff, manifest, review README, and targeted source ranges at the pinned head. The changed files inspected were `.gitmodules`, `3rdparty/libyuv` (submodule pointer only), `core/libs/CMakeLists.txt`, `core/libs/prx/libwebrtc/CMakeLists.txt`, `core/libs/prx/libwebrtc/Export.cpp`, `core/libs/prx/libwebrtc/include/Api.hpp`, `core/libs/prx/libwebrtc/src/VideoFrameBufferCropAndScale.cpp`, `core/libs/prx/libwebrtc/src/I420Buffer.cpp`, `core/libs/prx/libwebrtc/tests/I420BufferCreate.cpp` (diff), `core/libs/prx/libwebrtc/tests/VideoFrameBufferCropAndScale.cpp` (diff and selected ranges), `docs/dev/debt/changes/feat-webrtc-video-frame-buffer-crop-and-scale.md`, `tools/package_release.py`, and `tools/tests/test_package_release.py` (diff). `3rdparty/libyuv` was excluded because its text was unavailable. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | No verified blocking defect | | Tests | not run | Author-reported results were not rerun | | Submodule review | not run | Pointer inspected; contents unavailable | ## Findings ### Blocking None verified. ### Non-blocking No additional comments. ## Not verified The libyuv source and license files at the submodule revision, console behavior, and author-reported build and test results were not independently verified. Some changed test-file ranges were not read in full. ## To get this to a good state Nothing is required. The implementation has extensive author-reported tests, but those results were not rerun during this review.
mihiii1337 commented 2026-11-23 11:46:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T11:46:59Z.

Review: APPROVED


Re-reviewed exact head d3a8483c274de7c7bdbf2fdb16568658d736170f. This supersedes my earlier change request.

The remaining scaler-input/result blockers are fixed: non-positive crop widths and zero crop heights (including the INT_MIN paths) are rejected before conversion or allocation; destination plane sizing is checked in 64 bits before Create; source extent and null planes are checked before dispatch; and the result is published only after I420Scale returns success. Temporary references remain RAII-managed. As clarified earlier, I do not retain the allocation order as a separate blocker.

My exact-head source and test syntax checks, diff/merge checks, and conventions check passed. PrivacyOnion independently built and passed the four focused WebRTC tests on Linux with a negative control. The exact-head hosted Windows job is now green: it built and passed guest_webrtc_crop_and_scale, and completed 5,648 executed tests with zero failures. The Windows relinker, Linux/macOS relinkers, and relinker ASan jobs are also green.

I did not test console behavior or a GPU path.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6021129441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26079#pullrequestreview-6021129441). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T11:46:59Z. **Review:** APPROVED --- Re-reviewed exact head `d3a8483c274de7c7bdbf2fdb16568658d736170f`. This supersedes my earlier change request. The remaining scaler-input/result blockers are fixed: non-positive crop widths and zero crop heights (including the `INT_MIN` paths) are rejected before conversion or allocation; destination plane sizing is checked in 64 bits before `Create`; source extent and null planes are checked before dispatch; and the result is published only after `I420Scale` returns success. Temporary references remain RAII-managed. As clarified earlier, I do not retain the allocation order as a separate blocker. My exact-head source and test syntax checks, diff/merge checks, and conventions check passed. PrivacyOnion independently built and passed the four focused WebRTC tests on Linux with a negative control. The exact-head hosted Windows job is now green: it built and passed `guest_webrtc_crop_and_scale`, and completed 5,648 executed tests with zero failures. The Windows relinker, Linux/macOS relinkers, and relinker ASan jobs are also green. I did not test console behavior or a GPU path. AI-assisted: yes.

Pull request closed

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!26079
No description provided.