Skip to content

Commit 2e026d6

Browse files
andrepuschmanncodebot
authored andcommitted
radio,uhd: catch exception returned when parsing bad device args string
fix segfault when device args are malformed Warning: Scheduling priority of UHD not changed. Cause: Not enough privileges. terminate called after throwing an instance of 'uhd::value_error' what(): ValueError: invalid args string: type=b200,num_recv_frames=64,num_send_frames=64 --otw_format=sc12 Stack trace (most recent call last): | Source "./nptl/pthread_kill.c", line 78, in __pthread_kill_implementation Source "./nptl/pthread_kill.c", line 44, in __pthread_kill [0x7faa57cb1a7c]
1 parent 2d85da6 commit 2e026d6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/radio/uhd/radio_uhd_device.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ class radio_uhd_device : public uhd_exception_handler
5454
bool usrp_make(const std::string& device_address)
5555
{
5656
// Parse args into dictionary.
57-
uhd::device_addr_t device_addr(device_address);
57+
uhd::device_addr_t device_addr;
58+
if (!safe_execution([device_address, &device_addr]() { device_addr = uhd::device_addr_t(device_address); })) {
59+
return false;
60+
}
5861

5962
// Destroy any previous USRP instance
6063
usrp = nullptr;

0 commit comments

Comments
 (0)