Index: selRecord.c =================================================================== RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/rec/selRecord.c,v retrieving revision 1.17.2.2 retrieving revision 1.17.2.4 diff -u -b -r1.17.2.2 -r1.17.2.4 --- selRecord.c 29 Aug 2005 19:49:39 -0000 1.17.2.2 +++ selRecord.c 30 Jul 2007 16:18:04 -0000 1.17.2.4 @@ -1,19 +1,16 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* recSel.c */ -/* base/src/rec selRecord.c,v 1.17.2.2 2005/08/29 19:49:39 anj Exp */ +/* selRecord.c,v 1.17.2.4 2007/07/30 16:18:04 anj Exp */ -/* recSel.c - Record Support Routines for Select records */ +/* selRecord.c - Record Support Routines for Select records */ /* * Original Author: Bob Dalesio - * Current Author: Marty Kraimer * Date: 6-2-89 */ @@ -82,7 +79,7 @@ #define SEL_MAX 12 static void checkAlarms(); -static int do_sel(); +static void do_sel(); static int fetch_values(); static void monitor(); @@ -119,9 +116,7 @@ { psel->pact = TRUE; if ( RTN_SUCCESS(fetch_values(psel)) ) { - if( !RTN_SUCCESS(do_sel(psel)) ) { - recGblSetSevr(psel,CALC_ALARM,INVALID_ALARM); - } + do_sel(psel); } recGblGetTimeStamp(psel); @@ -333,7 +328,7 @@ return; } -static int do_sel(struct selRecord *psel) +static void do_sel(struct selRecord *psel) { double *pvalue; struct link *plink; @@ -346,6 +341,10 @@ pvalue = &psel->a; switch (psel->selm){ case (selSELM_Specified): + if (psel->seln >= SEL_MAX) { + recGblSetSevr(psel,SOFT_ALARM,INVALID_ALARM); + return; + } val = *(pvalue+psel->seln); break; case (selSELM_High_Signal): @@ -384,8 +383,8 @@ val = order[psel->seln]; break; default: - recGblSetSevr(psel,SOFT_ALARM,MAJOR_ALARM); - return(-1); + recGblSetSevr(psel,CALC_ALARM,INVALID_ALARM); + return; } if (!isinf(val)){ psel->val=val; @@ -394,7 +393,7 @@ recGblSetSevr(psel,UDF_ALARM,MAJOR_ALARM); /* If UDF is TRUE this alarm will be overwritten by checkAlarms*/ } - return(0); + return; } /* @@ -415,7 +414,8 @@ if(psel->selm == selSELM_Specified) { /* fetch the select index */ status=dbGetLink(&(psel->nvl),DBR_USHORT,&(psel->seln),0,0); - if (!RTN_SUCCESS(status)) return(status); + if (!RTN_SUCCESS(status) || (psel->seln >= SEL_MAX)) + return(status); plink += psel->seln; pvalue += psel->seln;