From f498b36438703eb941eaac15c87f94b8d679def6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Mar 2015 16:34:14 -0500 Subject: [PATCH 1/7] Prevent overflows in ao value conversion. Also makes ROFF fields unsigned, needed for ROFF=0x80000000 --- src/rec/aiRecord.dbd | 4 ++-- src/rec/aoRecord.c | 18 ++++++++++++++---- src/rec/aoRecord.dbd | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/rec/aiRecord.dbd b/src/rec/aiRecord.dbd index a7518ab73..69a9f396c 100644 --- a/src/rec/aiRecord.dbd +++ b/src/rec/aiRecord.dbd @@ -176,8 +176,8 @@ recordtype(ai) { pp(TRUE) interest(2) } - field(ROFF,DBF_LONG) { - prompt("Raw Offset, obsolete") + field(ROFF,DBF_ULONG) { + prompt("Raw Offset") pp(TRUE) interest(2) } diff --git a/src/rec/aoRecord.c b/src/rec/aoRecord.c index e4fb7e533..d2b45e832 100644 --- a/src/rec/aoRecord.c +++ b/src/rec/aoRecord.c @@ -469,10 +469,20 @@ static void convert(aoRecord *prec, double value) } value -= prec->aoff; if (prec->aslo != 0) value /= prec->aslo; - if (value >= 0.0) - prec->rval = (epicsInt32)(value + 0.5) - prec->roff; - else - prec->rval = (epicsInt32)(value - 0.5) - prec->roff; + + /* Apply raw offset and limits, round to 32-bit integer */ + value -= prec->roff; + if (value >= 0.0) { + if (value >= (0x7fffffff - 0.5)) + prec->rval = 0x7fffffff; + else + prec->rval = (epicsInt32)(value + 0.5); + } else { + if (value > (0.5 - 0x80000000)) + prec->rval = (epicsInt32)(value - 0.5); + else + prec->rval = 0x80000000; + } } diff --git a/src/rec/aoRecord.dbd b/src/rec/aoRecord.dbd index a1caa6b56..3c2d8cf9c 100644 --- a/src/rec/aoRecord.dbd +++ b/src/rec/aoRecord.dbd @@ -82,8 +82,8 @@ recordtype(ao) { interest(1) size(16) } - field(ROFF,DBF_LONG) { - prompt("Raw Offset, obsolete") + field(ROFF,DBF_ULONG) { + prompt("Raw Offset") pp(TRUE) interest(2) } From e84e7b930fc7bb0c9f66a22c44ef1dfc15a9b2aa Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Mar 2015 17:05:16 -0500 Subject: [PATCH 2/7] Release notes for ao-convert changes --- documentation/RELEASE_NOTES.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 6bbcb5643..71883d460 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,14 @@ +

aoRecord raw conversion overflows

+ +

The ao record type now checks converted raw values and limits them to the +32-bit integer range before writing them to the RVAL field. Previously value +overflows relied on Undefined Behaviour which could give different results on +different platforms. The ROFF fields of the ao and ai record types are now +DBF_ULONG to allow an ROFF setting of 0x80000000 to work properly.

+

Changes to <top>/cfg/* files

The order in which cfg/CONFIG* and cfg/RULES* files are included from support From 9470830091b01462803c580fd7168ae2b721a0c7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 23 Mar 2015 15:59:11 -0500 Subject: [PATCH 3/7] catools: Fix printing -ve DBF_LONG values on 64-bit --- src/catools/tool_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index 22ea66c7e..75225ee10 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -87,7 +87,8 @@ static void sprint_long (char *ret, dbr_long_t val, IntFormatT outType) "0x%lX" /* hex */ }; - sprintf(ret, fmt[outType], val); + /* Formats have long modifier, pass value as a long */ + sprintf(ret, fmt[outType], (long) val); } } From 583108e42a3ed7614b8651f4e154a7f696a3eef0 Mon Sep 17 00:00:00 2001 From: Janet Anderson Date: Tue, 24 Mar 2015 08:50:39 -0500 Subject: [PATCH 4/7] Set version number to R3.14.12.5. --- configure/CONFIG_BASE_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index a0783bb06..c98540e03 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -39,7 +39,7 @@ EPICS_PATCH_LEVEL = 5 #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV #EPICS_DEV_SNAPSHOT=-rc1 -EPICS_DEV_SNAPSHOT=-rc1-DEV +#EPICS_DEV_SNAPSHOT=-rc1-DEV #EPICS_DEV_SNAPSHOT=-rc2 #EPICS_DEV_SNAPSHOT=-rc2-DEV #EPICS_DEV_SNAPSHOT= From dc61957963525eef4a24ee2bf6141bacd18d9189 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Mar 2015 09:57:35 -0500 Subject: [PATCH 5/7] Set SNAPSHOT for R3.14.12.5 --- configure/CONFIG_BASE_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index c98540e03..b6ef79e5e 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -42,7 +42,7 @@ EPICS_PATCH_LEVEL = 5 #EPICS_DEV_SNAPSHOT=-rc1-DEV #EPICS_DEV_SNAPSHOT=-rc2 #EPICS_DEV_SNAPSHOT=-rc2-DEV -#EPICS_DEV_SNAPSHOT= +EPICS_DEV_SNAPSHOT= # No changes should be needed below here From 22768b2bb356b07f724a0db651f3d8305250528e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Mar 2015 10:08:56 -0500 Subject: [PATCH 6/7] Set SNAPSHOT back to -DEV --- configure/CONFIG_BASE_VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index b6ef79e5e..77601e929 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -33,7 +33,7 @@ EPICS_MODIFICATION = 12 EPICS_PATCH_LEVEL = 5 # This will end in -DEV between official releases -#EPICS_DEV_SNAPSHOT=-DEV +EPICS_DEV_SNAPSHOT=-DEV #EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 @@ -42,7 +42,7 @@ EPICS_PATCH_LEVEL = 5 #EPICS_DEV_SNAPSHOT=-rc1-DEV #EPICS_DEV_SNAPSHOT=-rc2 #EPICS_DEV_SNAPSHOT=-rc2-DEV -EPICS_DEV_SNAPSHOT= +#EPICS_DEV_SNAPSHOT= # No changes should be needed below here From 0a1cf17681df36a8b5700f66e889415b8567c895 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 25 Mar 2015 11:25:09 -0500 Subject: [PATCH 7/7] Trivial spacing changes in RELEASE_NOTES --- documentation/RELEASE_NOTES.html | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 71883d460..0b93f21af 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -198,6 +198,7 @@ them for continuous integration testing of static builds.

The problem building for the ios-x86 simulator target architecture has been resolved.

+

Changes between 3.14.12.3 and 3.14.12.4

New test for environment variables

@@ -386,6 +387,7 @@ with an increasing delay between messages up to hourly.

This fixes launchpad bug 597054.

+

Changes between 3.14.12.2 and 3.14.12.3

Hex literals in CALC expressions

@@ -533,6 +535,7 @@ entries in the CONFIG_SITE.darwinCommon.darwinCommon file in the versions of MacOS-X come with an implementation of readline, so those additional code repositories are no longer required.

+

Changes between 3.14.12.1 and 3.14.12.2

Path for Cap5 loadable library changed

@@ -2199,6 +2202,7 @@ been included using the EPICS_BASE_IOC_LIBS or EPICS_BASE_HOST_LIBS variables that are set in Base, and thus no changes will be needed.

+

Changes between 3.14.8.2 and 3.14.9

Cygwin Builds

@@ -2472,6 +2476,7 @@ targets.

Added support for EPICS_HOST_ARCH=darwin-x86.

+

Changes between 3.14.8.1 and 3.14.8.2

epicsStrtod

@@ -2481,6 +2486,7 @@ targets.

managed to break the use of this in the R3.14.8.1 release. This is now fixed.

+

Changes between 3.14.8 and 3.14.8.1

Version Numbering

@@ -2527,6 +2533,7 @@ on win32 architectures.

+

Changes between 3.14.7 and 3.14.8

New host targets

@@ -2745,6 +2752,7 @@ could not be created. This is fixed.

222 - osiSpawnDetachedProcess doesnt close open files in dupicate process on POSIX

+

Changes between 3.14.6 and 3.14.7

selRecord

@@ -2879,6 +2887,7 @@ can cause an IOC to crash.

when the ARCH defined in the ioc*/Makefile is present in BUILD_ARCHS for the build.

+

Changes between 3.14.5 and 3.14.6

CA command line tools complete

@@ -3131,6 +3140,7 @@ channels)

+

Changes between 3.14.4 and 3.14.5

dbtr

@@ -3310,9 +3320,8 @@ standard C escape characters to \xxx characters.

command, add registrar(iocshSystemCommand) to an application database description file.

-
-

Changes between 3.14.3 and 3.14.4

-
+ +

Changes between 3.14.3 and 3.14.4

sCalcPostfix

@@ -3362,9 +3371,8 @@ successfully connects.

Thanks to Mark Rivers for initially reporting the bug and energetically assisting with identifying the cause.

-
-

Changes between 3.14.2 and 3.14.3

-
+ +

Changes between 3.14.2 and 3.14.3

TPRO output

@@ -3565,9 +3573,8 @@ symptom was a hang during process exit. A workaround was installed.

A patch was made to allow multiple CA servers on MAC OSX. OSX is a recent branch off of BSD and therefore requires socket option SO_REUSEPORT.

-
-

Changes between 3.14.1 and 3.14.2

-
+ +

Changes between 3.14.1 and 3.14.2

Build System

@@ -3652,9 +3659,8 @@ that it ignores case.

macParseDefns did not check for handle==NULL. The documentation for macParseDefns was not correct.

-
-

Changes between 3.14.0beta2 and 3.14.1

-
+ +

Changes between 3.14.0beta2 and 3.14.1

function - New Database Definition Keyword