feat(libwebrtc): implement absl FastIntToBuffer for int #13687
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13687"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-10-30T23:56:23Z.
What
Implements
absl::numbers_internal::FastIntToBuffer(int, char*)in libwebrtc, which threw and was declared without parameters.The module's exact WebRTC revision is not known. Its
rtc::names (moved towebrtc::from M135) and thePushResampler<short>::Resample(InterleavedView…)overloads (added in M127) place it between M127 branch-heads/6533 and M134 branch-heads/6998. The export name has no abseil inline namespace, which matches the Chromium abseil that WebRTC pins inDEPS. Both ends pin abseil at 65ef38d368 and d212a71416, andFastIntToBuffer(int32_t),EncodeFullU32,EncodeHundredandPrepareEightDigitsare the same in both.The behaviour follows that code. The function writes a
-for negative values, then the decimal digits and a NUL, and returns a pointer to the NUL. For magnitudes from 10 to 99999999,EncodeFullU32does an 8-byte little-endian store with the digits shifted down, so the bytes after the digits are zero up to 8 bytes from the first digit. The implementation zeroes the same bytes. Abseil declares the bufferabsl::Nonnull<char*>and writes through it, so null is outside its contract. As a host-side defensive check, not console parity, a null buffer throwsstd::invalid_argumentinstead of faulting.The library had no
CMakeLists.txt, so this PR adds one that builds the same target as the generic rule incore/libs/CMakeLists.txtand registers the test. The debt file records the revision range and the source, and the inventory drops from 412 to 411.Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ON.guest_webrtc_fast_int_to_buffertest: on a buffer filled withx, 0, 7, -7, 10, -10, 123, -4567, 1234567, 99999999, -99999999, 100000000, 1234567890,INT_MAXandINT_MINproduce their decimal text and a NUL, and the returned pointer is the NUL. Bytes after the NUL are zero up to 8 bytes from the first digit for magnitudes from 10 to 99999999, and every byte after that is untouched. The defensive check is covered too: a null buffer throwsstd::invalid_argument.ctest -j16on head314a8c5b49: 3030/3030 pass.check_conventions.py --base upstream/mainpasses.pr_overlap.pyreports no overlap with open pull requests.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T00:12:52Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The null-buffer test and implementation assert a
std::invalid_argumentbehavior that the cited Abseil revisions do not specify; theirFastIntToBuffer(int32_t, ...)takes a non-null pointer and writes through it.What I ran
Reviewed head
314a8c5b492c364f6ce9d520e78dde41c2fa2a91on PR base0269d841bbc14b8c92a59b47aca4e18d3149596b. The merge preview against currentmain7ceda1326c82e86252d161fa12eef47498eb417dwas clean; the five commits since the prior preview touch unrelated exports and debt files. Environment: Linux 6.1.0-54-amd64, x86_64; Python 3.11.2. I did not build or compile the C++ target.Results
git diff --checkand conventions/template7ceda1326c82e86252d161fa12eef47498eb417d; interveningmaincommits changed unrelated export/debt files.passed_with_warnings. This lexical audit does not verify the compiled ABI. The precheck snapshot lacked this workspace helper, so I ran it separately from the workspace.guest_webrtc_fast_int_to_buffer. The quality heuristic's possible-unregistered warning is a false positive for thisCMAKE_CURRENT_SOURCE_DIRpath; the precheck snapshot lacked the workspace helper, so I ran it separately.Relevant unedited tool output
Negative control
std::invalid_argumentFindings
Blocking
Export.cppexplicitly throwsstd::invalid_argumentfor a null buffer, andTestNullBufferrequires that exception. Both cited Abseil revisions annotate this parameter asabsl::Nonnull<char*>and write through it without a null check. That establishes a non-null precondition, not a C++ exception contract for null. The PR body also says the reference “throws,” which is not supported by those sources. Please remove the null-specific conformance assertion and either remove the guard or document it as a deliberate host-side defensive behavior rather than console parity. If null is a supported console input with this exception result, provide evidence for that behavior.Non-blocking
The quality heuristic did not recognize the test registration, but the new
CMakeLists.txtexplicitly adds the executable and CTest entry. I found no separate blocker in the valid-input conversion path by source inspection; it has not been compiled or run in this review.Sources
65ef38dd212a71Not verified
I did not run the C++ tests, build the library, test Windows/macOS behavior, or verify behavior on a PS5. The author-reported full CTest run is not an independent result from this review.
To get this to a good state
Please remove or qualify the unsupported null-buffer behavior and update the test/body accordingly. I will rerun the same review checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T00:23:54Z.
Review: APPROVED
Re-checked — looks good
Correction on unchanged head
314a8c5b492c364f6ce9d520e78dde41c2fa2a91: my prior blocking finding treated a null buffer as supported input, but the pinned Abseil signature requiresabsl::Nonnull<char*>; the implementation's defensivestd::invalid_argumentcheck is outside that contract and is not a blocker. The PR text should describe the exception as local defensive behavior rather than upstream behavior.Sources
Not verified
I did not rerun local tests or a build for this correction; the PR head is unchanged, and the previous same-head review recorded the checks and author-reported test results.