Fix RingBuffer operator[] bounds check to use capacity instead of count#410
Merged
Conversation
The assertion `index < m_count` in RingBuffer::operator[] caused a crash
when accessing an empty buffer, since m_count is 0. The underlying storage
is always default-initialized (T m_data[N] = {}), so accessing any index
within capacity is memory-safe. Changed the precondition to `index < N`
for fixed-size and added `index < m_capacity` checks to DynamicRingBuffer
for consistency.
Fixes UtilsStress_RingBufferEmptyPop crash.
https://claude.ai/code/session_01ApyFVZ8srT8MofLK2bGVsn
Add CMake option ENABLE_LTO (default ON) to allow disabling link-time optimization for environments hitting GCC LTO ICEs (e.g. GCC 13's "resolution sub id not in object file" bug). Use -DENABLE_LTO=OFF to disable. Pin CI GCC jobs to gcc-14/g++-14 on ubuntu-24.04 which has the LTO fix. Applies to: build-linux-gcc, build-linux-asan, build-linux-tsan, coverage, and release workflows. https://claude.ai/code/session_01ApyFVZ8srT8MofLK2bGVsn
Contributor
Code Coverage (GCC + lcov)Per-Subsystem Coverage
Total: 57.9% (11191/19320 lines) |
Contributor
✅ CI Errors ResolvedAll previously reported errors have been fixed. All builds passing. Last checked: 2026-04-07T11:22:04Z |
The LoadTest_Severe_NetworkChurn test fails on Windows because rapid server start/stop cycles hit EADDRINUSE — the OS holds recently closed ports in TIME_WAIT state. Setting SO_REUSEADDR before bind allows immediate port reuse, which is standard practice for game server sockets. https://claude.ai/code/session_01ApyFVZ8srT8MofLK2bGVsn
The coverage job compiles with gcc-14 (gcov format B42*) but lcov defaults to /usr/bin/gcov (GCC 13, format B33*). Add --gcov-tool gcov-14 to the lcov capture command so the versions match. https://claude.ai/code/session_01ApyFVZ8srT8MofLK2bGVsn
Contributor
Code Coverage (GCC + lcov)Per-Subsystem Coverage
Total: 50.2% (17806/35461 lines) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The assertion
index < m_countin RingBuffer::operator[] caused a crashwhen accessing an empty buffer, since m_count is 0. The underlying storage
is always default-initialized (T m_data[N] = {}), so accessing any index
within capacity is memory-safe. Changed the precondition to
index < Nfor fixed-size and added
index < m_capacitychecks to DynamicRingBufferfor consistency.
Fixes UtilsStress_RingBufferEmptyPop crash.
https://claude.ai/code/session_01ApyFVZ8srT8MofLK2bGVsn