epics-base / pvaClientCPP

pvaClientCPP is an EPICS V4 C++ module
http://epics-pvdata.sourceforge.net/index.html
Other
2 stars 8 forks source link

MultiChannel class segmentation fault if requested structure is missing expected fields #57

Closed sveseli closed 5 years ago

sveseli commented 5 years ago

If one of the structures being retrieved via the MultiChannel class does not have some fields that are typically found in standard records (e.g., "alarm"), the code will crash due to the null pointer access:

Core was generated by `python -c from pvaccess import *; mc = MultiChannel(['c1','c2']); print(mc.get('.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f6d94e5985b in epics::pvaClient::PvaClientNTMultiData::endDeltaTime
    (this=0x559a943e6f10) at ../pvaClientNTMultiData.cpp:151
151                 severity[i] = pvst->getSubField<PVInt>("alarm.severity")->get();

Ideally, if MultiChannel class is going to support retrieving PVs with arbitrary structures, "expected" missing fields would be simply ignored and corresponding entries in the NTMultiChannel structure would be left empty.

mrkraimer commented 5 years ago

Pull request #59 fixes the segmentation fault. Note that NTMulti does require a top level value field in each PvaClientChannel. Thus issue #56 has not been addressed. Needs more thought.