Skip to content

Default-initialize CSV factory's cached event/run/thread ids#149

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/128-csv-uninit-members
Jun 13, 2026
Merged

Default-initialize CSV factory's cached event/run/thread ids#149
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/128-csv-uninit-members

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

event_number, runId, and thread_id in GstreamerCsvFactory were declared without initializers. In run mode, publishRunDigitizedDataImpl writes event_number and thread_id directly, but the run path never goes through startEvent/publishEventHeader, so both ints were read while uninitialized — undefined behavior, emitting garbage into the evn and thread_id columns of every run-mode CSV row.

Initialize all three to -1 (matching the JSON factory's fallback convention) so the run-mode columns are deterministic and machine-parseable.

Validation: CSV plugin compiles clean (Geant4 11.4.1 dev container).

Fixes #128

event_number, runId, and thread_id were declared without initializers.
In run mode, publishRunDigitizedDataImpl writes event_number and
thread_id directly, but the run path never goes through startEvent or
publishEventHeader, so both ints were read uninitialized — undefined
behavior emitting garbage into the evn and thread_id columns of every
run-mode CSV row. Initialize all three to -1 (matching the JSON
factory's fallback convention) so the columns are deterministic.

Fixes gemc#128

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit 4e04c67 into gemc:main Jun 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Medium] CSV run-mode rows print uninitialized event_number and thread_id

2 participants