Experimental Physics and Industrial Control System
Hi,
I experienced crashes of EDM related to the use of the XY-graph widget
on the Linux x86_64 platform.
Crashes of EDM on 64-bit systems have been reported earlier on this
mailing list:
http://www.aps.anl.gov/epics/tech-talk/2010/msg00915.php
http://www.aps.anl.gov/epics/tech-talk/2010/msg00227.php
I think that I now found the origin of these crashes:
The code in xygraph.cc makes assumptions about the size of the int and
long datatypes. In particular it assumes that both int and long are 32
bit. While this is true for 32-bit systems, on 64-bit systems long is
64-bit.
Because of these assumptions, the sub-arrays in the yPvData array are
allocated to small and other data is overwritten when these arrays are
accessed as arrays of longs.
I attached a patch for EDM 1.12.39 which should fix this problem.
Instead of using hard-coded sizes for different data types, it uses the
sizeof operator in order to determine how much memory needs to be allocated.
I could not find an e-mail address for the EDM maintainer in the EDM
sources. Thus, I hope that someone from the EDM maintainers is reading
this mailing-list, so that this patch can be included in future EDM
releases.
Until then, I hope this patch might be useful for other people
experiencing the same problem.
- Sebastian
diff -Naur edm-1.12.39.orig/baselib/xygraph.cc edm-1.12.39/baselib/xygraph.cc
--- edm-1.12.39.orig/baselib/xygraph.cc 2010-10-27 16:02:15.000000000 +0200
+++ edm-1.12.39/baselib/xygraph.cc 2010-12-17 21:35:56.000000000 +0100
@@ -9025,25 +9025,29 @@
// specificType
switch ( yPvType[i] ) {
case ProcessVariable::specificType::flt:
- eleSize = 4;
+ eleSize = sizeof(float);
break;
case ProcessVariable::specificType::real:
- eleSize = 8;
+ eleSize = sizeof(double);
break;
case ProcessVariable::specificType::shrt:
- eleSize = 2;
+ eleSize = sizeof(short);
break;
case ProcessVariable::specificType::chr:
- eleSize = 1;
+ eleSize = sizeof(char);
break;
case ProcessVariable::specificType::integer:
- eleSize = 4;
+ // At some places in the code, integers are assumed to
+ // be longs. As on some platforms (64-bit) long has
+ // 8 bytes and int has only 4 bytes, we assume the
+ // longer one here to be save.
+ eleSize = sizeof(long);
break;
case ProcessVariable::specificType::enumerated:
- eleSize = 2;
+ eleSize = sizeof(short);
break;
default:
- eleSize = 8;
+ eleSize = sizeof(double);
break;
}
@@ -9080,25 +9084,29 @@
// specificType
switch ( xPvType[i] ) {
case ProcessVariable::specificType::flt:
- eleSize = 4;
+ eleSize = sizeof(float);
break;
case ProcessVariable::specificType::real:
- eleSize = 8;
+ eleSize = sizeof(double);
break;
case ProcessVariable::specificType::shrt:
- eleSize = 2;
+ eleSize = sizeof(short);
break;
case ProcessVariable::specificType::chr:
- eleSize = 1;
+ eleSize = sizeof(char);
break;
case ProcessVariable::specificType::integer:
- eleSize = 4;
+ // At some places in the code, integers are assumed to
+ // be longs. As on some platforms (64-bit) long has
+ // 8 bytes and int has only 4 bytes, we assume the
+ // longer one here to be save.
+ eleSize = sizeof(long);
break;
case ProcessVariable::specificType::enumerated:
- eleSize = 2;
+ eleSize = sizeof(short);
break;
default:
- eleSize = 8;
+ eleSize = sizeof(double);
break;
}
- Navigate by Date:
- Prev:
Re: building latest snapshot of streamDevice Ben Franksen
- Next:
Re: Breakpoint Tables David Dudley
- 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: Build EPICS 3.14.12 in windows 7 by MS VC++ 2010 Express Wang Xiaoqiang
- Next:
openmotif installtion problems. Saed Abu Ghannam
- 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