Closed JaCoHSU closed 2 weeks ago
I just found this same issue. The GetAvailableBytes function in the Linux driver passes a pointer to "ui16 bytes" to the ioctl function call. In this case, ioctl is expecting a pointer to an int, which is larger than 16 bits. Because "bytes" is a return variable, it is located on the stack. That means that ioctl smashes the bytes variable on the stack.
For reference, I'm working with a Linux/ARM64 configuration.
Hello! Thank you for your feedback. We need some time to examine this problem. We also want to inform you that we are preparing version 2.0, which includes many advanced features and new detailed example. We plan to release it in the near future.
I can confirm that this only happens when CMAKE_BUILD_TYPE=Release
and not with CMAKE_BUILD_TYPE=Debug
. A workaround to get CMAKE_BUILD_TYPE=Release
working is disabling compiler optimization by setting:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
Navigate here and change 'bytes' type to ui32. It should work like this.
Changing ui16 to ui32 worked for me. Thanks for your help!
Hello everybody,
I am using the simplebgc code on a jetson. When I build the project with dcmake_build_type=debug everything works fine. However, when I build it with dcmake_build_type=release the code crashes with "stack smashing detected". I am not sure where the problem is. I tried to break it down and it seems that the code crashes in the core.c when generalSBGC->AvailableBytesFunc() is called.
Any ideas why this is happening in release and how to solve it?