EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: aSub INPA field and CPP attribute on win32-x86 platform
From: Janez Golob <[email protected]>
To: [email protected]
Date: Thu, 02 Aug 2012 09:15:06 +0200
Hey everyone,

few days ago I found the following strange behavior of the aSub record on win32-x86 platform. Lets star with an simple example that can be used to reproduce the issue:

record(waveform,"GET_ERRORS")
{
  field(FTVL, "CHAR")
  field(NELM, "314")
  field(SCAN, ".1 second")
  field(PINI, "YES")
}

record(aSub, "DO_SOMETHING_WITH_ERRORS")
{
  field(BRSV, "INVALID")
  ## input array
  field(INPA, "GET_ERRORS CPP")
  field(FTA,  "CHAR")
  field(NOA,  "314")
}

When this two records are loaded the segmentation fault occur. When running the ioc with debugger one can see the following function located in dbConvert.c is called before INPA link address of the aSub record is resolved:

static long getCharChar(
    const dbAddr *paddr,
    void *pto, long nRequest, long no_elements, long offset)

paddr is zeroed. In case there is no CPP the paddr contains expected information.

But there is also a good news :) You can overcome this issue by changing the second record like this:

record(aSub, "DO_SOMETHING_WITH_ERRORS")
{
  field(BRSV, "INVALID")
  ## Used to overcome win32 issue
  field(INPC, "GET_ERRORS CPP")
  ## input array
  field(INPA, "GET_ERRORS")
  field(FTA,  "CHAR")
  field(NOA,  "314")
}

So it seems only the INPA link is vulnerable.

I am using the following configuration:
 - EPICS base: 3.14.12 (win32-x86 and win32-x86-debug targets)
 - Compiler: Visual C++ 2010 Express

Regards,
Janez

Replies:
Re: aSub INPA field and CPP attribute on win32-x86 platform Andrew Johnson

Navigate by Date:
Prev: Camac TMA 3112 documentation? Mike Westfall
Next: Re: stream device string/hex parsing Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Camac TMA 3112 documentation? Mike Westfall
Next: Re: aSub INPA field and CPP attribute on win32-x86 platform Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024