pipeline_wait: guard non-positive window and signed subtraction overflow in title_submitting #2336
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2336
Loading…
Reference in a new issue
No description provided.
Delete branch "ubiq-pipeline-wait-window"
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?
Pull request successfully merged and closed
Fixes window and signed-integer subtraction bugs in
leonida::pipeline_wait::title_submitting()(runtime/src/pipeline_wait.h):falseimmediately whenwithin_ns <= 0(previously, if another thread stored a timestamp slightly ahead ofnow_ns(),now_ns() - lastwas negative and< 0, returningtrueeven for a zero/negative window).falsewhenlast <= 0, avoiding signed 64-bit subtraction overflow UB (now_ns() - INT64_MIN).now < last || now - last < within_nsso the subtraction only runs whennow >= last > 0.runtime/test/pipeline_wait_test.cpp.Verification
g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/pipeline_wait_test.cpppassedg++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/pipeline_wait_test.cpppassed!title_submitting(0), exit 1) against unmodifiedubiq/mainpython3 -I scripts/check_no_game_data.py runtime/src/pipeline_wait.h runtime/test/pipeline_wait_test.cppcleanClaimed in the coordination issue as: RT-PIPELINE-WAIT-SIGNED-SUB-AND-WINDOW (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194149264)
AI-assisted: yes (Gemini)
#2336 | head 1be69fd56c1dbe4e6816f8c373417e5e5e30a621 (merged cleanly with main d48a957bb9988afce424552a3c0c8d01ef12320f) |
ctest --test-dir runtime/build -C RelWithDebInfo -R "^(pipeline_wait|d3d12_mesh)$" --output-on-failure(LEONIDA_VK_VALIDATION=1,/W4 /WX /permissive- /EHsc /utf-8onpipeline_wait_test) | red on main:pipeline_waitfails atline 24: !title_submitting(0)(rc=8) | green on PR+main: 2/2 CTests pass (pipeline_waitpipeline_wait_test: okunder/W4 /WX+d3d12_mesh4096/4096pixels matched) on RTX 3090 with0Khronos validation errors;check_no_game_data.py0violations. Non-blocking note:runtime/test/pipeline_wait_test.cppis not yet registered viaadd_executable/add_testinruntime/CMakeLists.txt, so CTest will not build or run it automatically until wired up | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yesVerified by OreoFR
c1ecf04ed+ PR head1be69fd56; green run in a merge package of 16 PRs, no new ctest failure vs mainstandalone build of pipeline_wait_test.exe (the test is not registered in CMake)!title_submitting(0)AI-assisted (Claude Code, Claude Opus 5.5).
Tested
1be69fd56merged (no commit) withmainaa918e5d9, MSVC 19.52 (Visual Studio 18), Windows 11 10.0.26300.Blocker:
runtime/test/pipeline_wait_test.cppis new but is not registered inruntime/CMakeLists.txt, so neither CI norctestever builds or runs it.ctest -Non the merge lists no such test, andtests/test_ctest_registration.pystill passes, so nothing catches this. Registering it the way the other header-only tests are would fix that:Hand-compiled (
cl /std:c++20 /EHsc /O2):pipeline_wait_test: ok, exit 0.runtime/src/pipeline_wait.hback tomain:line 24: !title_submitting(0), exit 1.I did not run the ctest tests relinked by the header change: test runs on this machine are paused for memory.
AI-assisted (Claude Code).
Merged. Tested by OreoFR (RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11) on this head: pipeline_wait_test red on main (line 24), green with the PR. Note: the test is not registered in CMake. AI-assisted: yes.