test_dfi fails when optimizing
There's something weird going on with the dynfunction tests:
[ RUN ] DynFunctionTests.DynFuncTest2
==64079==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7fff76e507b0 at pc 0x7dd750145945 bp 0x7fff76e50740 sp 0x7fff76e50730 WRITE of size 8 at 0x7fff76e507b0 thread T0 #0 0x7dd750145944 in ffi_call_int (/home/oipo-unencrypted/Programming/ffi/lib/libffi.so.7+0x56944) #1 0x7dd7511815e6 in dynFunction_call /home/oipo-unencrypted/Programming/celix-apache/libs/dfi/src/dyn_function.c:240 #2 0x5591d28e4e5f in func_test2 /home/oipo-unencrypted/Programming/celix-apache/libs/dfi/gtest/src/dyn_function_tests.cpp:113 #3 0x5591d28ea093 in DynFunctionTests_DynFuncTest2_Test::TestBody() /home/oipo-unencrypted/Programming/celix-apache/libs/dfi/gtest/src/dyn_function_tests.cpp:124 #4 0x5591d2b56597 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2433 #5 0x5591d2b3d868 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2469 #6 0x5591d2ac8209 in testing::Test::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2508 #7 0x5591d2acac6d in testing::TestInfo::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2684 #8 0x5591d2acda4b in testing::TestSuite::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2816 #9 0x5591d2af5a79 in testing::internal::UnitTestImpl::RunAllTests() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:5338 #10 0x5591d2b5a8c4 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2433 #11 0x5591d2b41b19 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2469 #12 0x5591d2aebe1e in testing::UnitTest::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:4925 #13 0x5591d2b89ea8 in RUN_ALL_TESTS() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/include/gtest/gtest.h:2473 #14 0x5591d2b89d54 in main /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest_main.cc:45 #15 0x7dd75031d1e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2) #16 0x5591d2878a3d in _start (/home/oipo-unencrypted/Programming/celix-apache/build/libs/dfi/gtest/test_dfi+0x526a3d)
Address 0x7fff76e507b0 is located in stack of thread T0 SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow (/home/oipo-unencrypted/Programming/ffi/lib/libffi.so.7+0x56944) in ffi_call_int Shadow bytes around the buggy address: 0x10006edc20a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10006edc20b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10006edc20c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10006edc20d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10006edc20e0: 00 00 00 00 00 00 00 00 00 00 00 00 ca ca ca ca =>0x10006edc20f0: 00 00 00 00 ca ca[ca]ca 00 00 00 00 00 00 00 00 0x10006edc2100: 00 00 00 00 00 00 00 00 00 00 00 00 cb cb cb cb 0x10006edc2110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10006edc2120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 0x10006edc2130: f1 f1 04 f2 04 f2 00 00 f3 f3 00 00 00 00 00 00 0x10006edc2140: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==64079==ABORTING [ RUN ] JsonAvprRpcTests.prep
==64243==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7ffe09a5385c at pc 0x7a61dca6f480 bp 0x7ffe09a53810 sp 0x7ffe09a52fb8 READ of size 1 at 0x7ffe09a5385c thread T0 #0 0x7a61dca6f47f (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f) #1 0x7a61db8bfdab (/lib/x86_64-linux-gnu/libjansson.so.4+0x7dab) #2 0x7a61db8bfdf7 (/lib/x86_64-linux-gnu/libjansson.so.4+0x7df7) #3 0x7a61db8bc63a (/lib/x86_64-linux-gnu/libjansson.so.4+0x463a) #4 0x7a61db8bc928 (/lib/x86_64-linux-gnu/libjansson.so.4+0x4928) #5 0x7a61db8bd05f (/lib/x86_64-linux-gnu/libjansson.so.4+0x505f) #6 0x7a61db8bd255 (/lib/x86_64-linux-gnu/libjansson.so.4+0x5255) #7 0x7a61db8bd0e6 (/lib/x86_64-linux-gnu/libjansson.so.4+0x50e6) #8 0x7a61db8bd255 (/lib/x86_64-linux-gnu/libjansson.so.4+0x5255) #9 0x7a61db8bd0e6 (/lib/x86_64-linux-gnu/libjansson.so.4+0x50e6) #10 0x7a61db8bd395 (/lib/x86_64-linux-gnu/libjansson.so.4+0x5395) #11 0x7a61db8bd756 in json_loadf (/lib/x86_64-linux-gnu/libjansson.so.4+0x5756) #12 0x7a61dc95c031 in dynFunction_parseAvpr /home/oipo-unencrypted/Programming/celix-apache/libs/dfi/src/dyn_avpr_function.c:57 #13 0x7a61dc95c2a5 in dynFunction_parseAvprWithStr /home/oipo-unencrypted/Programming/celix-apache/libs/dfi/src/dyn_avpr_function.c:76 #14 0x5c2ddfefcb6b in JsonAvprRpcTests_prep_Test::TestBody() /home/oipo-unencrypted/Programming/celix-apache/libs/dfi/gtest/src/json_rpc_avpr_tests.cpp:173 #15 0x5c2ddfffa1db in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2433 #16 0x5c2ddffe14ac in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2469 #17 0x5c2ddff6be4d in testing::Test::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2508 #18 0x5c2ddff6e8b1 in testing::TestInfo::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2684 #19 0x5c2ddff7168f in testing::TestSuite::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2816 #20 0x5c2ddff996bd in testing::internal::UnitTestImpl::RunAllTests() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:5338 #21 0x5c2ddfffe508 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2433 #22 0x5c2ddffe575d in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const) /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:2469 #23 0x5c2ddff8fa62 in testing::UnitTest::Run() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest.cc:4925 #24 0x5c2de002daec in RUN_ALL_TESTS() /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/include/gtest/gtest.h:2473 #25 0x5c2de002d998 in main /home/oipo-unencrypted/Programming/celix-apache/build/_deps/googletest-src/googletest/src/gtest_main.cc:45 #26 0x7a61dbaf51e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2) #27 0x5c2ddfd1ca3d in _start (/home/oipo-unencrypted/Programming/celix-apache/build/libs/dfi/gtest/test_dfi+0x526a3d)
Address 0x7ffe09a5385c is located in stack of thread T0 SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f) Shadow bytes around the buggy address: 0x1000413426b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000413426c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000413426d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000413426e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000413426f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x100041342700: 00 00 00 00 00 00 00 00 ca ca ca[ca]00 00 00 00 0x100041342710: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100041342720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100041342730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100041342740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100041342750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==64243==ABORTING