Recently, while trying some examples with et_wish
at Daresbury Lab, it was noticed that it is possible
to cause a crash by monitoring the VAL field
of an "mbbi" record which is using "Raw Soft Channel"
device support.
The crash occurs if RVAL is set to a value which does
not correspond to a valid state.
Looking at "tclCa.c", the relevant code appears to be at
line 983:
case DBF_ENUM:
if (strlen(pch->info.e.strs[pch->pdata->e.value]) != 0) {
Tcl_SetVar(pch->interp, pch->pitem->tclname,
pch->info.e.strs[pch->pdata->e.value],
TCL_GLOBAL_ONLY);
} else {
sprintf(buf, "%d", pch->pdata->e.value);
Tcl_SetVar(pch->interp, pch->pitem->tclname, buf,
TCL_GLOBAL_ONLY);
}
break;
The crash is caused by the "pch->info.e.strs[pch->pdata->e.value]"
because the index into the strs is out of range.
One solution would be to replace this with:
if( pch->pdata->e.value <= pch->info.e.no_str )
{
Tcl_SetVar(pch->interp, pch->pitem->tclname,
pch->info.e.strs[pch->pdata->e.value],
TCL_GLOBAL_ONLY);
}
else
{
sprintf(buf, "%d", pch->pdata->e.value);
Tcl_SetVar(pch->interp, pch->pitem->tclname, buf,
TCL_GLOBAL_ONLY);
}
break;
So that we only use a valid index into the array of state strings
otherwise we just report the value as given.
Cheers,
Andy
--------------------------------------------------------------------
Observatory Sciences Limited Email: [email protected]
William James House Tel: 44 - (0)1223 - 508259
Cowley Road Fax: 44 - (0)1223 - 508258
Cambridge, CB4 0WX, UK http://www.observatorysciences.co.uk
- Replies:
- Re: An et_wish crash EPICS User
- Navigate by Date:
- Prev:
Re: Ladder logic programing for PLC Marty Kraimer
- Next:
Using a terminal server to catch boot messages bickley
- Index:
1994
1995
1996
1997
1998
1999
2000
<2001>
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Ladder logic programing for PLC Marty Kraimer
- Next:
Re: An et_wish crash EPICS User
- Index:
1994
1995
1996
1997
1998
1999
2000
<2001>
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|