|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0093 |
| Class | BUG |
| Severity | 1 |
| Status | ready |
Models: —
Found: 2026-10-24, follow-up of FHSIM-0094 and FHSIM-0095 (feature fhsim-review-fixes)
Feature fhsim-review-fixes made the parameter accessors, initial conditions, NumCores, <Diagnostics>, <Timing>, <StepControl>, <LinearSolver>, <Jacobian>, State Dimension, TOutput and port constants strict (src/simobject/utilities/StrictParse.h). These reads still use prefix parsers (std::stoi, std::stod, atof, atoi, fhlib Str2*), so "3abc" reads as 3 and a word as 0:
src/simobject/utilities/InputReader.cpp:207,226 (atof), :236 (Str2DblArr), :247 (Str2IntArr), :310,329 (atoi), :504 (Str2Int), :530 (Str2Dbl). Generic utility that SimObjects read their attributes through.src/engine/integrator/sundials/SundialsOptionApplier.cpp:131-161 (stoi/stod of the <SundialsExtra> pairs).src/engine/io/SimulationManagerFactory.cpp:164 (std::stoi timeout), :181 (std::stod simulation speed), :221 (std::stod frame rate).src/engine/core/Parse.cpp:292 (<State Range> through Str2IntVec, which reads a prefix).src/engine/integrator/sundials/SundialsStateIO.cpp:45 (tStart from the initial-conditions file, Str2Dbl).src/engine/core/SimulationBuilder.cpp:87 (Str2Int(numCores); unreachable for a bad value since NumCores is validated when it is parsed, but a config built in code skips that).A mistyped value in one of these places is read as a prefix or as 0 without a message.
Use the StrictParse.h helpers and report the element, attribute and text, as XmlParseHelpers.h does. InputReader needs a decision on whether a SimObject that reads through it gets an error or a return code.
A test per site with "3abc" and a word, expecting an error that names the text.
Inputs that rely on the prefix read stop running; scan the consumers' inputs first.