Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bulletproofing for the case that waveform data come before the first channel header word #121

Open
wants to merge 1 commit into
base: release/v1_10_06
Choose a base branch
from

Conversation

tomjunk
Copy link
Contributor

@tomjunk tomjunk commented Feb 7, 2025

Description

This PR _Fixes #120 _

The method decode_data in NevisTPCUtilities.cc is not guarded against the case where data that are interpreted as ADC data (either with type kADC or kADCHuffman) come before the first kChannelHeader word in a fragment. Such data are corrupt, as we do not know what channel they correspond to, and the currentWaveformPtr is uninitialized, causing a segfault. This was spotted trying to decode data from run 18101, taken January 7, 2025.

Related Repository Branches

No related branches, just this one.

Testing details

Bug reproduction before this PR:

gdb --args lar -c run_decoders_job.fcl root://fndca1.fnal.gov:1094//pnfs/fnal.gov/usr/sbnd/archive/sbn/sbn_nd/data/raw/unknown/v1_10_04/sbnd_daq_v1_10_04/daq/00/01/81/01/data_EventBuilder1_art1_run18101_1_strmUnknown_20250107T214345.root

Program received signal SIGSEGV, Segmentation fault.
sbndaq::NevisTPCDecoder::decode_data (this=this@entry=0x7ffffffdd0b0, data_ptr=, n_words=n_words@entry=40593, wvfm_map=...)
at /home/trj/saut/triggerdecoder/sbndc4/srcs/sbndaq_artdaq_core/sbndaq-artdaq-core/Overlays/SBND/NevisTPC/NevisTPCUtilities.cc:97
97 currentWaveformPtr->emplace_back( currentWaveformPtr->back() + differences[i_diff - 1] );

Decoding this file succeeds with this PR, but the data do look corrupt from run 18101 Lots of invalid fragment handles, duplicate
channel headers, mismatching headers and trailers, and the event displays look choppy. But the decoder succeeds.

same story with data_EventBuilder3_art1_run18101_1_strmUnknown_20250107T214346.root

I also tested a normal file to make sure the decoding wasn't broken by this PR:

data_EventBuilder5_art1_run18214_100_strmBNBZeroBias_20250205T145349.root

decoded just fine.

@tomjunk
Copy link
Contributor Author

tomjunk commented Feb 7, 2025

I also ran indent-region and untabify in emacs so there are a few changes to the whitespace.

@gennadiy-fnal gennadiy-fnal changed the base branch from develop to release/v1_10_06 February 10, 2025 16:00
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.

3 participants