Commit 22607fe
committed
Fix null-pointer crash in TimeSeriesManager%get_time_series
BndTsHashTable is only allocated by HashBndTimeSeries(), which
tsmanager_df() calls only when numtsfiles > 0. In a simulation with
no TS6 files, the hash table stays unassociated. If a list-input
value that should be numeric or a time-series name fails to parse as
numeric (e.g. a malformed AUX or boundname column), get_time_series()
dereferences that null pointer directly, crashing with SIGSEGV instead
of falling through to the intended "Expected numeric value or
time-series name, but found '...'" error.
Guard the hash-table lookup with an associated() check, matching the
existing pattern in the sibling GetLink() function in this same file.
With no TS files loaded, no time-series name can match by definition,
so returning "not found" is exactly correct -- this lets the intended
error path fire instead of crashing.
Verified with a debug build (-fcheck=all): before the fix, a
malformed LAK PACKAGEDATA aux value reproducibly segfaults; after,
MF6 reports the expected input-parsing error and terminates cleanly.1 parent 95c88c1 commit 22607fe
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
467 | | - | |
468 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
469 | 471 | | |
470 | 472 | | |
471 | 473 | | |
| |||
0 commit comments