We are seeing a very similar problem at Jefferson Lab. Buffer overflows as soon as I process a device record.
I am using Stream over Asyn with CR-only terminators, configured ala:
# String terminator settings at ASYN level (? - MJ)
asynOctetSetInputEos("PGUNFDIV",0,"\r")
asynOctetSetOutputEos("PGUNFDIV",0,"\r")
#DEBUGGING
asynSetTraceMask("PGUNFDIV",-1,0x9)
asynSetTraceIOMask("PGUNFDIV",-1,0x2)
In Stream, I do not set any terminators (redundant?).
I am getting these errors after applying the patch. Any thoughts?
Cexp>2015/04/10 12:25:29.570 104-Com-8sm write -1 , bufflen = 1, buffaddr = 8c4edc
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000@\000\000\000\004\000\000\000\004\314\225\000\000\000\000\000\000\000\000\000\000
2015/04/10 12:25:29.910 104-Com-8sm write 0
Program heap: free of bad pointer 8C4EDC -- range 832928 - 1F6C0000
2015/04/10 12:25:30.210 104-Com-8sm write -1 , bufflen = 1, buffaddr = 9894c4
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000@\000\000\000\004\000\000\000\004\314\225\000\000\000\000\000\000\000\000\000\000
2015/04/10 12:25:30.570 104-Com-8sm write 0
Program heap: free of bad pointer 98assertion "(uread(BSP_UART_COM1, LSR) & THRE) != 0" failed: file "../../../../../../../../rtems-4.9.2/c/src/lib/libbsp/i386/pc386/../../i386/shared/comm/uart.c", line 585, function: BSP_uart_termios_write_com1
Here is the path I applied (after changing "print" to "printf" to get it to compile):
StreamEpics.cc
916,918c916,918
< StreamBuffer fullname;
< fullname.printf("%s.%s", name(), fieldname);
< if (dbNameToAddr(fullname(), &dbaddr) != OK)
---
> char fullname[PVNAME_SZ + 1];
> sprintf(fullname, "%s.%s", name(), fieldname);
> if (dbNameToAddr(fullname, &dbaddr) != OK)
921,923c921,923
< fullname.clear().printf("%s.VAL", fieldname);
< if (dbNameToAddr(fullname(), &dbaddr) != OK) return false;
< }
---
> sprintf(fullname, "%s.VAL", fieldname);
> if (dbNameToAddr(fullname, &dbaddr) != OK) return false;
> }
With Context:
[205] michaelj@devl01 > diff -c StreamEpics.cc StreamEpics.cc.orig
*** StreamEpics.cc 2015-04-09 14:57:09.264306145 -0400
--- StreamEpics.cc.orig 2015-04-09 14:13:40.706615881 -0400
***************
*** 913,926 ****
else
{
// FIELD in this record or VAL in other record
! StreamBuffer fullname;
! fullname.printf("%s.%s", name(), fieldname);
! if (dbNameToAddr(fullname(), &dbaddr) != OK)
{
// VAL in other record
! fullname.clear().printf("%s.VAL", fieldname);
! if (dbNameToAddr(fullname(), &dbaddr) != OK) return false;
! }
}
address.append(&dbaddr, sizeof(dbaddr));
return true;
--- 913,926 ----
else
{
// FIELD in this record or VAL in other record
! char fullname[PVNAME_SZ + 1];
! sprintf(fullname, "%s.%s", name(), fieldname);
! if (dbNameToAddr(fullname, &dbaddr) != OK)
{
// VAL in other record
! sprintf(fullname, "%s.VAL", fieldname);
! if (dbNameToAddr(fullname, &dbaddr) != OK) return false;
! }
}
address.append(&dbaddr, sizeof(dbaddr));
return true;