aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorThomas Tsou <ttsou@vt.edu>2012-04-07 23:51:03 -0400
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2013-06-24 01:51:02 +0400
commitcd576c9636244938a42d8c69da012e45e9fdd4f5 (patch)
tree04b2cbc3019666d3c454218f195fab4ad3f1944c /Transceiver52M
parent3eeda4841ded1df4b5384df09b1358d5ef440cae (diff)
uhd: fix local overflow handling of buffer reads
This patches fixes the hypothetical bug in the read out of the intermediate sample buffer after a local overflow condition. Local overflows - occurring in the intermediate storage buffer and not the UHD transport - should never occur; the existence of a local overflow indicates a significant error elsewhere in the system. For example, if timestamps or timing offsets are ridiculously off, such errors may occur. Nonetheless, handle errors anyways by taking the modulo value of the calculated read index to stay within the buffer and avoid seg faulting. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/UHDDevice.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index bd8e1c3..61cc76e 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -1041,7 +1041,7 @@ ssize_t smpl_buf::read(void *buf, size_t len, TIMESTAMP timestamp)
num_smpls = len;
// Starting index
- size_t read_start = data_start + (timestamp - time_start) % buf_len;
+ size_t read_start = (data_start + (timestamp - time_start)) % buf_len;
// Read it
if (read_start + num_smpls < buf_len) {