mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-04 15:10:20 +00:00
529b6fd1b8
Add a test which triggers two event sources in the loop's "before" control hook, and destroys the second source in the loop's "after" control hook, and then reenters the loop in the event handler of the first source. At the moment, this test triggers a use-after-free. ==2973914==ERROR: AddressSanitizer: heap-use-after-free on address 0x608000000440 [...] READ of size 4 at 0x608000000440 thread T0 #0 0x7fa97f60c6b7 in loop_iterate ../spa/plugins/support/loop.c:376 #1 0x7fa98472c1eb in pw_main_loop_run ../src/pipewire/main-loop.c:148 #2 0x559995af7a76 in destroy_managed_source_before_dispatch_recurse ../test/test-loop.c:355 #3 0x559995b02678 in start_test_nofork ../test/pwtest.c:882 #4 0x559995b06191 in run_test ../test/pwtest.c:1087 #5 0x559995b0948a in run_tests ../test/pwtest.c:1283 #6 0x559995b0aea4 in main ../test/pwtest.c:1482 #7 0x7fa98360130f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) #8 0x7fa9836013c0 in __libc_start_main@GLIBC_2.2.5 (/usr/lib/libc.so.6+0x2d3c0) #9 0x559995aed754 in _start (/home/pb/temp/src/pipewire/build/test/test-loop+0x26754) 0x608000000440 is located 32 bytes inside of 96-byte region [0x608000000420,0x608000000480) freed by thread T0 here: #0 0x7fa984ffda79 in __interceptor_free /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x7fa97f60b03a in process_destroy ../spa/plugins/support/loop.c:344 #2 0x7fa97f60cbf8 in loop_iterate ../spa/plugins/support/loop.c:387 #3 0x559995af5b62 in dmsbd_recurse_on_event ../test/test-loop.c:298 #4 0x7fa97f60d826 in source_io_func ../spa/plugins/support/loop.c:396 #5 0x7fa97f60c7e7 in loop_iterate ../spa/plugins/support/loop.c:377 #6 0x7fa98472c1eb in pw_main_loop_run ../src/pipewire/main-loop.c:148 #7 0x559995af7a76 in destroy_managed_source_before_dispatch_recurse ../test/test-loop.c:355 #8 0x559995b02678 in start_test_nofork ../test/pwtest.c:882 #9 0x559995b06191 in run_test ../test/pwtest.c:1087 #10 0x559995b0948a in run_tests ../test/pwtest.c:1283 #11 0x559995b0aea4 in main ../test/pwtest.c:1482 #12 0x7fa98360130f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) previously allocated by thread T0 here: #0 0x7fa984ffdfb9 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x7fa97f60d883 in loop_add_io ../spa/plugins/support/loop.c:408 #2 0x559995af75de in destroy_managed_source_before_dispatch_recurse ../test/test-loop.c:349 #3 0x559995b02678 in start_test_nofork ../test/pwtest.c:882 #4 0x559995b06191 in run_test ../test/pwtest.c:1087 #5 0x559995b0948a in run_tests ../test/pwtest.c:1283 #6 0x559995b0aea4 in main ../test/pwtest.c:1482 #7 0x7fa98360130f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) SUMMARY: AddressSanitizer: heap-use-after-free ../spa/plugins/support/loop.c:376 in loop_iterate |
||
---|---|---|
.. | ||
meson.build | ||
pwtest-compat.c | ||
pwtest-implementation.h | ||
pwtest.c | ||
pwtest.h | ||
test-array.c | ||
test-client.c | ||
test-config.c | ||
test-context.c | ||
test-example.c | ||
test-functional.c | ||
test-lib.c | ||
test-logger.c | ||
test-loop.c | ||
test-map.c | ||
test-properties.c | ||
test-pwtest.c | ||
test-spa-buffer.c | ||
test-spa-json.c | ||
test-spa-log.c | ||
test-spa-node.c | ||
test-spa-pod.c | ||
test-spa-utils.c | ||
test-support.c | ||
test-utils.c |