diff options
author | Josh Blum <josh@joshknows.com> | 2011-11-07 16:34:13 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-07 16:34:13 -0800 |
commit | d28e3ac765273d7684386c1985802000d22eeea6 (patch) | |
tree | 525744fa17ffa1e628cd28397bc424be83e594f7 /host/lib | |
parent | f1434d7c52728cbf80e954b4c9414a94eec4c9ce (diff) | |
download | uhd-d28e3ac765273d7684386c1985802000d22eeea6.tar.gz uhd-d28e3ac765273d7684386c1985802000d22eeea6.tar.bz2 uhd-d28e3ac765273d7684386c1985802000d22eeea6.zip |
uhd: dont pass 0 sample buffs to converter (avoid segfaults)
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/convert/gen_convert_general.py | 1 | ||||
-rw-r--r-- | host/lib/transport/super_recv_packet_handler.hpp | 4 | ||||
-rw-r--r-- | host/lib/transport/super_send_packet_handler.hpp | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/host/lib/convert/gen_convert_general.py b/host/lib/convert/gen_convert_general.py index eafb145e6..52b4212b4 100644 --- a/host/lib/convert/gen_convert_general.py +++ b/host/lib/convert/gen_convert_general.py @@ -72,7 +72,6 @@ DECLARE_CONVERTER(sc16_item32_$(end), 1, $(cpu_type), 1, PRIORITY_GENERAL){ } DECLARE_CONVERTER(sc8_item32_$(end), 1, $(cpu_type), 1, PRIORITY_GENERAL){ - if (nsamps == 0) return; //otherwise segfault const item32_t *input = reinterpret_cast<const item32_t *>(size_t(inputs[0]) & ~0x3); $(cpu_type)_t *output = reinterpret_cast<$(cpu_type)_t *>(outputs[0]); $(cpu_type)_t dummy; diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index 48b0acdb9..57aae96b1 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -523,7 +523,9 @@ private: } //copy-convert the samples from the recv buffer - _converter(buff_info.copy_buff, _io_buffs, nsamps_to_copy_per_io_buff, _scale_factor); + if (nsamps_to_copy_per_io_buff != 0) _converter( + buff_info.copy_buff, _io_buffs, nsamps_to_copy_per_io_buff, _scale_factor + ); //update the rx copy buffer to reflect the bytes copied buff_info.copy_buff += bytes_to_copy; diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 5696b5d39..c3ffcc861 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -239,7 +239,9 @@ private: otw_mem += if_packet_info.num_header_words32; //copy-convert the samples into the send buffer - _converter(_io_buffs, otw_mem, nsamps_per_buff, _scale_factor); + if (nsamps_per_buff != 0) _converter( + _io_buffs, otw_mem, nsamps_per_buff, _scale_factor + ); //commit the samples to the zero-copy interface size_t num_bytes_total = (_header_offset_words32+if_packet_info.num_packet_words32)*sizeof(boost::uint32_t); |