FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0133 — SeineOperation segfaults on a parameter error before the tension filter is set up
ID 0133
Class BUG
Severity 2
Status ready

Models: Seine/Operation

Found: 2026-11-02, feature shared-testtools (T6): SeineCallOrder without AttractorNameNet crashed in SeineOperation::SeineOperation [clone .cold] once the test creator reported the missing parameter as an error.

Evidence

  • src/seine/SeineOperation.cpp:49 creator->GetStringParam("AttractorNameNet", m_attractorNameNet); (no default) and every getter above it run before :51-54, which say "The filter is set up before any check can throw" and call m_BridleTensionFilter.Initialize(2, tensionFilterConstant);.
  • A parameter error throws: fhsim/src/simobject/utilities/PrintDuringExec.cpp:170-173 [[noreturn]] void PrintDuringExec::ReportError(...) { ...; throw(Exceptions(errorMessage)); }.
  • fhlib sfh/filters/IIR: IIR::IIR() sets m_adVal, m_adLastMeasurement, m_adMeasurementDiff, m_adValueDiff to 0 but not m_adValueAdvance; IIR::~IIR() does delete[] m_adValueAdvance;.

When the constructor throws before Initialize, the member m_BridleTensionFilter is destroyed and deletes an uninitialised pointer.

Effect

A missing AttractorNameNet, or any bad parameter read before line 54, crashes FhSim (segfault) instead of reporting the parameter error.

Possible fix

  1. fishery: call m_BridleTensionFilter.Initialize(...) first in the constructor, before any parameter getter that can throw (read TensionFilterConstant first). Local, no result change.
  2. fhlib: IIR::IIR() also sets m_adValueAdvance = 0 (fhlib is not in repos/; needs an fhlib release). Fixes every user of a default-constructed IIR.

Do 1 now; report 2 to fhlib.

Test that would prove it

Construct Seine/Operation with the test creator and no AttractorNameNet: expect a thrown parameter error naming AttractorNameNet, not a crash (fails today with a segfault).

Risk

None for valid input: the filter's initial state does not depend on the other parameters.