bladeRF
bladeRF copied to clipboard
fix(test_repeater): bug in termios handling
I got compilation error on Fedora 36 with pybombs, so it turned out that there is a bug in this code. termios_backup
is a pointer so we should not use &
operator for memcpy
Having this issue too.
[INFO] Installing package: bladeRF [WARNING] Build dir already exists: /home/yoav/projects/pybombs/bladeRF/src/bladeRF/host/build Building: (100%) [==========================================================================================================================================================================================================================] [ 3%] Built target ad936x [ 23%] Built target libbladerf_shared [ 23%] Built target libbladeRF_test_async [ 25%] Built target libbladeRF_test_bootloader_recovery [ 25%] Built target libbladeRF_test_c [ 26%] Built target libbladeRF_test_cpp [ 32%] Built target libbladeRF_test_ctrl [ 34%] Built target libbladeRF_test_freq_hop [ 36%] Built target libbladeRF_test_fw_check [ 37%] Built target libbladeRF_test_open [ 39%] Built target libbladeRF_test_parse [ 41%] Built target libbladeRF_test_peripheral_timing Consolidate compiler generated dependencies of target libbladeRF_test_repeater [ 41%] Building C object libraries/libbladeRF_test/test_repeater/CMakeFiles/libbladeRF_test_repeater.dir/src/repeater.c.o In function ‘term_init’, inlined from ‘repeater_run’ at /home/yoav/projects/pybombs/bladeRF/src/bladeRF/host/libraries/libbladeRF_test/test_repeater/src/repeater.c:790:14: /home/yoav/projects/pybombs/bladeRF/src/bladeRF/host/libraries/libbladeRF_test/test_repeater/src/repeater.c:115:5: error: array subscript ‘unsigned char[60][0]’ is partly outside array bounds of ‘struct termios[0]’ [-Werror=array-bounds] 115 | memcpy(&termios_new, &termios_backup, sizeof(termios_new)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/yoav/projects/pybombs/bladeRF/src/bladeRF/host/libraries/libbladeRF_test/test_repeater/src/repeater.c: In function ‘repeater_run’: /home/yoav/projects/pybombs/bladeRF/src/bladeRF/host/libraries/libbladeRF_test/test_repeater/src/repeater.c:96:24: note: object ‘termios_backup’ of size 8 96 | static struct termios *termios_backup = NULL; | ^~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [libraries/libbladeRF_test/test_repeater/CMakeFiles/libbladeRF_test_repeater.dir/build.make:90: libraries/libbladeRF_test/test_repeater/CMakeFiles/libbladeRF_test_repeater.dir/src/repeater.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:1055: libraries/libbladeRF_test/test_repeater/CMakeFiles/libbladeRF_test_repeater.dir/all] Error 2 make: *** [Makefile:136: all] Error 2 [ERROR] Build failed. See output above for error messages. [ERROR] Problem occurred while building package bladeRF: Build failed. [ERROR] Error installing package bladeRF. Aborting.
The project is not compiling under GCC 12 and the memcpy call is incorrect. The fix works and should be merged to master.