Repository navigation
fix(runtime): guard extreme signed handles - #17953
Conversation
Validate handles and user IDs before subtracting their bases. Extreme negative inputs otherwise trigger signed-overflow undefined behavior before the range checks.
Reject extreme invalid handles before subtracting one in getPort. INT_MIN otherwise triggers signed-overflow undefined behavior.
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Context from the 2026-11-11 sanitizer nightly (run Yesterday's failure set did not include it; it arrived with the port-bounds audit That makes this PR the fix for the nightly's new failure, not just a hardening change. I also ran AI-assisted. |
|
Windows check of head Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
What
Reject out-of-range signed Pad and AudioOut handles before subtracting the handle base.
INT_MINpreviously caused signed overflow in Pad special-handle, port and user-ID helpers and in AudioOut port lookup. Valid handles and existing error returns are preserved.Tested
1f2e495095cf39f45095619705a3870e665d08c3directly on upstream main3e089775b9a12e3d2e70ede255363c522dbf3135.INT_MINsubtractions with Windows GCC 15.2 signed-overflow sanitizer (0xC000001D). These establish the original undefined arithmetic; they are not full-library tests.3e089775b9a12e3d2e70ede255363c522dbf3135plus all ten pinned candidate patches completed 3219/3219 incremental Ninja steps, including runtime libraries and relinker. Focused CTest passed 20/20, includingguest_padandaudio_out_last_output_time. Earlier full integration build on main5e04f680adcompleted 4369/4369 with 20/20 focused tests. These are integrated-tree results, not an isolated full build of this branch.tools/check_conventions.py --base origin/mainandgit diff --check origin/main...HEADpassed on this rebased head. C++20 syntax-only compilation passed on Windows before rebase.getPortrange guard. No matchingINT_MINarithmetic fix found.Checklist