CA client crashes on providing 0 as user callback
Bug #1369626 reported by
Ralph Lange
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
Medium
|
Andrew Johnson |
Bug Description
When calling ca_array_
IMHO the CA client should be a bit more robust and not add the user callback when it is NULL.
Related branches
Changed in epics-base: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Agreed that this should not cause the client to crash. Whether it should be an error though is an interesting question.
For ca_array_ get_callback( ) and ca_create_ subscription( ) I can see no valid reason to want to pass a NULL callback routine, so those routines should return an error immediately in that case. In fact looking at the code I see that ca_create_ subscription( ) is already doing that check and returns ECA_BADFUNCPTR if pCallBack is NULL.
For ca_array_ put_callback( ) though a client might want to trigger the dbNotify mechanism in the IOC but not get told the result. For the purposes of this bug-fix I'm not proposing we allow that without some discussion, but we might consider adding it later.
The attached patch to the 3.14 branch adds checks in 2 places: Return ECA_BADFUNCPTR from the C API implementation, and also prevents the callback mechanisms from trying to call a NULL function pointer (since the internal C++ API does not do the checks). Not tested.