dbStatic: Fixed crash loading record of unknown type

Fixed segfault when dbLoadRecords tried to load a record of a
type that was not defined in its DBD files.
This commit is contained in:
Andrew Johnson
2013-12-04 17:37:42 -06:00
parent 4ac35ab85c
commit 76e967c960
2 changed files with 13 additions and 5 deletions

View File

@@ -14,6 +14,11 @@
<!-- Insert new items immediately below here ... -->
<h3>Fixed crash loading record instance of unknown type</h3>
<p>Fixed segfault when dbLoadRecords tried to load a record of a type that was
not defined in its DBD files.</p>
<h3>Hex literal support in epicStrtod()</h3>
<p>Some OS implementations of the standard C library routine strtod() do not

View File

@@ -112,8 +112,6 @@ static void yyerrorAbort(char *str)
{
yyerror(str);
yyAbort = TRUE;
while (ellCount(&tempList))
popFirstTemp();
}
static void allocTemp(void *pvoid)
@@ -256,6 +254,11 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp,
my_buffer_ptr = my_buffer;
ellAdd(&inputFileList,&pinputFile->node);
status = pvt_yy_parse();
if (yyAbort)
while (ellCount(&tempList))
popFirstTemp();
dbFreePath(pdbbase);
if(!status) { /*add RTYP and VERS as an attribute */
DBENTRY dbEntry;
@@ -923,7 +926,7 @@ static void dbRecordHead(char *recordType, char *name, int visible)
allocTemp(pdbentry);
status = dbFindRecordType(pdbentry, recordType);
if (status) {
epicsPrintf("Record \"%s\" is of unknown type \"%s\" - ",
epicsPrintf("Record \"%s\" is of unknown type \"%s\"\n",
name, recordType);
yyerrorAbort(NULL);
return;
@@ -932,8 +935,8 @@ static void dbRecordHead(char *recordType, char *name, int visible)
status = dbCreateRecord(pdbentry,name);
if (status==S_dbLib_recExists) {
if (strcmp(recordType, dbGetRecordTypeName(pdbentry))!=0) {
epicsPrintf("Record \"%s\" already defined with different type "
"\"%s\"\n", name, dbGetRecordTypeName(pdbentry));
epicsPrintf("Record \"%s\" of type \"%s\" redefined with new type "
"\"%s\"\n", name, dbGetRecordTypeName(pdbentry), recordType);
yyerror(NULL);
duplicate = TRUE;
return;