i use the command g++ main.cpp -g -std=c++17 -fsanitize=address -I./boost_1_77_0/include/ -L./boost_1_77_0/lib/ -lboost_coroutine -lboost_thread -lboost_context -lboost_chrono -lpthread to compile, and use env LD_LIBRARY_PATH=./boost_1_77_0/lib/:$LD_LIBRARY_PATH ./a.out to run
if using ioc.stop() to make ioc.run() exit, it will abort by AddressSanitizer when the program exit. i use gdb to trace and found that aborting occurred at ~io_context function, which call make_fcontext finally.
i guess this is a false positive caused by make_fcontext, but why? is there any way to solve this false positive?
in addition, should i also use ioc.stop() to stop io_context? is there a problem with this code?
AFAIK make_fcontext() is used in boost::coroutines to start the stackfull coroutine, so there could be some "magic" code which does setup the coroutine and sanitizer didnt like it.
using g++ v9.1.0 and Boost v1.77 AddressSanitizer reports stack-buffer-overflow when program exit
there is the code
and the directory structure is
i use the command
g++ main.cpp -g -std=c++17 -fsanitize=address -I./boost_1_77_0/include/ -L./boost_1_77_0/lib/ -lboost_coroutine -lboost_thread -lboost_context -lboost_chrono -lpthread
to compile, and useenv LD_LIBRARY_PATH=./boost_1_77_0/lib/:$LD_LIBRARY_PATH ./a.out
to runif using
ioc.stop()
to makeioc.run()
exit, it will abort by AddressSanitizer when the program exit. i use gdb to trace and found that aborting occurred at~io_context
function, which callmake_fcontext
finally.i guess this is a false positive caused by make_fcontext, but why? is there any way to solve this false positive?
in addition, should i also use
ioc.stop()
to stop io_context? is there a problem with this code?