FIX - Shm truncation guard#549
Open
Sahil-u07 wants to merge 4 commits into
Open
Conversation
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.
Summary
Fix a correctness bug in the C++ shared-memory write path that previously logged a warning and continued writing truncated payloads. Oversized payloads now fail fast by throwing a
std::runtime_error, preventing silently corrupted data from flowing through a running study.Changes
SHM_SIZE.std::runtime_errorwhen the payload size is >=SHM_SIZEin both shared-memory write paths.Why this matters
Silent truncation of SHM payloads can corrupt downstream neuromodulation calculations and produce incorrect scientific results without any visible error in running studies. This change forces a visible failure so users notice and fix configuration (increase
SHM_SIZEor reduce payloads) rather than producing silent, incorrect outputs.Testing / CI
g++installed.test_oversized_payload_throws— non-zero exit, stderr contains "Aborting", no "truncated".test_within_limit_succeeds— exit 0, no stderr.test_exactly_at_limit_throws— non-zero exit.test_one_under_limit_succeeds— exit 0, no stderr.