test(libkernel): cover socket options negative length and invalid protocol level bounds #14472
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14472"
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 slopgobblercobbler on 2026-11-01T14:52:25Z.
What
Enhances socket option boundary and error condition test coverage in
core/libs/tests/GuestSocketStreamOptions.cpp:setsockoptwith invalid protocol levels (-1, 1, 2, 17, 99, 1234, 0x10000) returningEINVAL(22).setsockoptwith negative lengths (static_cast<std::uint32_t>(-1)and-4) returningEINVAL(22).TcpLevelandSocketLevelwith negative length returningENOPROTOOPT(42).Tested
GuestSocketStreamOptions.cpplocally against FreeBSD socket option emulation: exited cleanly with code 0.python tools/check_conventions.py --base upstream/main --head HEAD: 0 findings.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-11-02T05:15:34Z.
Review: COMMENTED
Reviewed — no blocking findings
The new assertions use the
setsockoptentry point at base, which rejects any level other than socket level, IP, TCP and IPv6 with EINVAL (Socket/src/Udp.cpplines 1305-1307). The unknown-level cases in the test match that rule. I did not trace the TCP-option-on-datagram and negative-length cases through the option dispatch (SocketOptions.cpp), so those are not verified here. Test-only change. The hosted Windows CTest run had one case, a tool check; the stream options test did not run there.What I ran
bb36e9baf3d3c24dd5f9593676e6681c46ab192b; basee450145140...(the base moved since the first review; the diff is against the PR's own base). 1 file, +21/-0:core/libs/tests/GuestSocketStreamOptions.cpp.setsockopt_nid_postfixentry point at base (Socket/src/Udp.cpplines 1300-1312).Results
Udp.cpplines 1305-1307Invalid)SocketOptions.cppwas not readSocketOptions.cppwere not readRead-only check output
Precheck was not run: no PR-head code is run here. Conventions: passed. Hosted:
gh api repos/boykopovar/AnyPS5/commits/bb36e9baf3d3c24dd5f9593676e6681c46ab192b/check-runs.Negative control
Not run here. A negative control needs a build, and code from this head is not run here.
Findings
Blocking
None.
Non-blocking
None.
Sources
github.com/boykopovar/AnyPS5@bb36e9baf3/core/libs/tests/GuestSocketStreamOptions.cppgithub.com/boykopovar/AnyPS5@f2d874c1fd/core/libs/prx/libkernel/Socket/src/Udp.cpp (L1300-L1307)Not verified
SocketOptions.cpp.To get this to a good state