From 675cb86f15c65893791fe5e4ec4914eb4484e6d6 Mon Sep 17 00:00:00 2001 From: Frank Stettner Date: Tue, 17 Dec 2019 19:55:28 +0100 Subject: [PATCH] hp-3478a: Check for overflow. --- src/hardware/hp-3478a/protocol.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hardware/hp-3478a/protocol.c b/src/hardware/hp-3478a/protocol.c index 74acd144..7842f2f4 100644 --- a/src/hardware/hp-3478a/protocol.c +++ b/src/hardware/hp-3478a/protocol.c @@ -497,6 +497,10 @@ SR_PRIV int hp_3478a_receive_data(int fd, int revents, void *cb_data) if (sr_scpi_get_double(scpi, NULL, &devc->measurement) != SR_OK) return FALSE; + /* Check for overflow. */ + if (devc->measurement >= 9.998e+9) + devc->measurement = INFINITY; + /* * This is necessary to get the actual range for the encoding digits. * Must be called after reading the value, because it resets the