epics-modules / autosave

APS BCDA synApps module: autosave
https://epics-modules.github.io/autosave/
Other
8 stars 31 forks source link

Segmentation fault when autosaving long string-type fields #59

Open simon-ess opened 6 months ago

simon-ess commented 6 months ago

This is similar to what @MarkRivers reported in #53, but not the exact same

What we found is that the following creates a segmentation fault for what I presume to be a similar reason:

record(waveform, "foo") {
    field(NELM, "100")
    field(FTVL, "CHAR")
    info(autosaveFields, "VAL VAL$")
}

then the pArray is never initialised in this block: https://github.com/epics-modules/autosave/blob/606903e17/asApp/src/save_restore.c#L1423, since the waveform initially reports the number of max_elements as 0.

Note that if you only try to save VAL or VAL$ alone (or if FTVL is not CHAR then this doesn't happen.

In short, the behaviour of autosave with long strings is a bit bizarre and prone to issues.