ka9q / ka9q-radio

Multichannel SDR based on fast convolution and IP multicasting
GNU General Public License v3.0
165 stars 38 forks source link

Fix signed integer overflows #14

Closed argilo closed 2 years ago

argilo commented 2 years ago

GCC's Undefined Behaviour Sanitizer (-fsanitize=undefined) identifies several signed integer overflows when airspyd is started:

avahi.c:289:42: runtime error: left shift of 239 by 24 places cannot be represented in type 'int'
airspyd.c:785:30: runtime error: left shift of 1770000000 by 1 places cannot be represented in type 'int'
multicast.c:284:26: runtime error: left shift of 2 by 30 places cannot be represented in type 'int'

I've corrected those here by switching to unsigned integer types. I also corrected the same issue in rtlsdr.

ka9q commented 2 years ago

I made some slight tweaks to your fixes. Rather than cast a hex constant to unsigned, I just appended "u".