Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update the ffmpeg detection/plugin for v.1.x+ otherwise compilation fails (solution included) #6

Closed
ChristianFrisson opened this issue Nov 4, 2012 · 2 comments

Comments

@ChristianFrisson
Copy link

I tried compiling osgdb_ffmpeg on OSX using ffmpeg 1.0 from MacPorts, it fails with OSX 10.6.8 and Xcode 3.2.6 and OSX 10.7.5 and Xcode 4.5.

It seems that ffmpeg now ships a header file called "time.h" in libavutil, and the compiler gets to include this one before its own.

osg/CMakeModules/FindFFmpeg.cmake reads:

In ffmpeg code, old version use #include <header.h> and newer use #include <libname/header.h>

In OSG ffmpeg plugin, we use #include <header.h> for compatibility with old version of ffmpeg

I would suggest to modify FindFFmpeg.cmake so as to use #include <libname/header.h> only, as I did for a fork in shotdetect:
johmathe/shotdetect@ffb85ed

Then, ffmpeg includes in osg/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp can be adapted accordingly.

What do you think?

@ChristianFrisson
Copy link
Author

osg/src/osgPlugins/ffmpeg/FFmpegParameters.cpp includes 2 ffmpeg headers to be prepended with libavutil/ too.

openscenegraph pushed a commit that referenced this issue Jul 21, 2014
…gText/Glyph.cpp if

the scene tree contains (large) 2D textures from images with STRIDE.

============================================================================
#0  0x00007fffe8ea4350 in __memmove_ssse3 () from /lib64/libc.so.6
#1  0x00007fffe52ced76 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#2  0x00007fffe52d8e86 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#3  0x00007fffe53dd8be in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#4  0x00007fffe53c2643 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#5  0x00007fffe53c7fdd in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#6  0x00007fffe53cbabf in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#7  0x00007fffe53cc1fa in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#8  0x00007ffff30092fd in osgText::GlyphTexture::apply (this=0x1bb8cf0, state=
    ...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/src/osgText/Glyph.cpp:234
#9  0x00007ffff56c30b6 in osg::State::applyAttributeOnTexUnit (this=0x125f180,
    unit=0, attribute=0x1bb8cf0, as=...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:1713
#10 0x00007ffff56c2f3f in osg::State::applyTextureAttribute (this=0x125f180,
    unit=0, attribute=0x1bb8cf0)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:411
#11 0x00007ffff30204da in osgText::Text::drawTextWithBackdrop (this=0x1baed70,
    state=..., colorMultiplier=...)
==============================================================================

The crash disappears if I either (1) disable the use of images with stride
in the (public) osgGeo-library, or (2) add the following bugfix to Glyph.cpp.
This combination gives me the confidence that I understand where this problem
originates from, without trying to understand the full OpenGL details.

===============================================================================
@@ -221,7 +223,12 @@
             imageData[i] = 0;
         }

+        glPixelStorei(GL_UNPACK_ALIGNMENT,1);

+        #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
+        #endif
+
         // allocate the texture memory.
         glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
                 getTextureWidth(), getTextureHeight(), 0,
================================================================================

I have copied (and adapted) the added lines above from the same source file,
where they were used in front of a similar call to glTexSubImage2D(.) around
line 515.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14372 16af8721-9629-0410-8352-f15c8da7e697
openscenegraph pushed a commit that referenced this issue Jul 21, 2014
the scene tree contains (large) 2D textures from images with STRIDE.

============================================================================
#0  0x00007fffe8ea4350 in __memmove_ssse3 () from /lib64/libc.so.6
#1  0x00007fffe52ced76 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#2  0x00007fffe52d8e86 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#3  0x00007fffe53dd8be in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#4  0x00007fffe53c2643 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#5  0x00007fffe53c7fdd in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#6  0x00007fffe53cbabf in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#7  0x00007fffe53cc1fa in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#8  0x00007ffff30092fd in osgText::GlyphTexture::apply (this=0x1bb8cf0, state=
    ...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/src/osgText/Glyph.cpp:234
#9  0x00007ffff56c30b6 in osg::State::applyAttributeOnTexUnit (this=0x125f180,
    unit=0, attribute=0x1bb8cf0, as=...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:1713
#10 0x00007ffff56c2f3f in osg::State::applyTextureAttribute (this=0x125f180,
    unit=0, attribute=0x1bb8cf0)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:411
#11 0x00007ffff30204da in osgText::Text::drawTextWithBackdrop (this=0x1baed70,
    state=..., colorMultiplier=...)
==============================================================================

The crash disappears if I either (1) disable the use of images with stride
in the (public) osgGeo-library, or (2) add the following bugfix to Glyph.cpp.
This combination gives me the confidence that I understand where this problem
originates from, without trying to understand the full OpenGL details.

===============================================================================
@@ -221,7 +223,12 @@
             imageData[i] = 0;
         }

+        glPixelStorei(GL_UNPACK_ALIGNMENT,1);

+        #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
+        #endif
+
         // allocate the texture memory.
         glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
                 getTextureWidth(), getTextureHeight(), 0,
================================================================================

I have copied (and adapted) the added lines above from the same source file,
where they were used in front of a similar call to glTexSubImage2D(.) around
line 515."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14371 16af8721-9629-0410-8352-f15c8da7e697
@openscenegraph
Copy link
Owner

OSG-3.4 should address this build issues with ffmpeg.

openscenegraph pushed a commit that referenced this issue May 18, 2016
the scene tree contains (large) 2D textures from images with STRIDE.

============================================================================
#0  0x00007fffe8ea4350 in __memmove_ssse3 () from /lib64/libc.so.6
#1  0x00007fffe52ced76 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#2  0x00007fffe52d8e86 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#3  0x00007fffe53dd8be in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#4  0x00007fffe53c2643 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#5  0x00007fffe53c7fdd in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#6  0x00007fffe53cbabf in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#7  0x00007fffe53cc1fa in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#8  0x00007ffff30092fd in osgText::GlyphTexture::apply (this=0x1bb8cf0, state=
    ...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/src/osgText/Glyph.cpp:234
#9  0x00007ffff56c30b6 in osg::State::applyAttributeOnTexUnit (this=0x125f180,
    unit=0, attribute=0x1bb8cf0, as=...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:1713
#10 0x00007ffff56c2f3f in osg::State::applyTextureAttribute (this=0x125f180,
    unit=0, attribute=0x1bb8cf0)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:411
#11 0x00007ffff30204da in osgText::Text::drawTextWithBackdrop (this=0x1baed70,
    state=..., colorMultiplier=...)
==============================================================================

The crash disappears if I either (1) disable the use of images with stride
in the (public) osgGeo-library, or (2) add the following bugfix to Glyph.cpp.
This combination gives me the confidence that I understand where this problem
originates from, without trying to understand the full OpenGL details.

===============================================================================
@@ -221,7 +223,12 @@
             imageData[i] = 0;
         }

+        glPixelStorei(GL_UNPACK_ALIGNMENT,1);

+        #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
+        #endif
+
         // allocate the texture memory.
         glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
                 getTextureWidth(), getTextureHeight(), 0,
================================================================================

I have copied (and adapted) the added lines above from the same source file,
where they were used in front of a similar call to glTexSubImage2D(.) around
line 515."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14371 16af8721-9629-0410-8352-f15c8da7e697
Nika-Keks pushed a commit to Nika-Keks/OpenSceneGraph that referenced this issue Sep 28, 2021
/home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:166:34: runtime error: reference binding to misaligned address 0x562ea892076c for type 'const struct TestStruct1', which requires 8 byte alignment
0x562ea892076c: note: pointer points here
  00 74 73 31 00 00 00 00  00 00 f8 3f 00 00 00 00  00 00 04 40 21 79 4b 08  00 00 00 74 65 73 74 5f
              ^
    #0 0x562ea6462b8e in deserialize /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:166
    openscenegraph#1 0x562ea68b7402 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:172
    openscenegraph#2 0x562ea68b7bf6 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:204
    openscenegraph#3 0x562ea68b86ea in LuaUtil::deserialize(sol::state&, std::basic_string_view<char, std::char_traits<char> >, LuaUtil::UserdataSerializer const*) /home/elsid/dev/openmw/components/lua/serialization.cpp:251
    openscenegraph#4 0x562ea6464d96 in TestBody /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:197
    openscenegraph#5 0x562ea6d9dac6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    openscenegraph#6 0x562ea6d9dac6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    openscenegraph#7 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2682
    openscenegraph#8 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2672
    openscenegraph#9 0x562ea6d93024 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2861
    openscenegraph#10 0x562ea6d93728 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2834
    openscenegraph#11 0x562ea6d93728 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:3015
    openscenegraph#12 0x562ea6d94142 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2994
    openscenegraph#13 0x562ea6d94142 in testing::internal::UnitTestImpl::RunAllTests() /home/elsid/dev/googletest/googletest/src/gtest.cc:5855
    openscenegraph#14 0x562ea6d9e096 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    openscenegraph#15 0x562ea6d9e096 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    openscenegraph#16 0x562ea6d93140 in testing::UnitTest::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:5438
    openscenegraph#17 0x562ea5d3fdc6 in RUN_ALL_TESTS() /home/elsid/dev/googletest/build/gcc/release/install/include/gtest/gtest.h:2490
    openscenegraph#18 0x562ea5d3fc6f in main /home/elsid/dev/openmw/apps/openmw_test_suite/openmw_test_suite.cpp:11
    openscenegraph#19 0x7fe3938d0b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    openscenegraph#20 0x562ea5d3fb7d in _start (/home/elsid/dev/openmw/build/gcc/ubsan/openmw_test_suite+0x173eb7d)

/home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:176:34: runtime error: reference binding to misaligned address 0x562ea892078f for type 'const struct TestStruct2', which requires 4 byte alignment
0x562ea892078f: note: pointer points here
 75 63 74 32 04  00 00 00 03 00 00 00 04  00 6e 64 69 74 69 6f 6e  73 00 73 68 61 70 65 00  51 00 00
             ^
    #0 0x562ea6462df9 in deserialize /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:176
    openscenegraph#1 0x562ea68b7402 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:172
    openscenegraph#2 0x562ea68b7bf6 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:204
    openscenegraph#3 0x562ea68b86ea in LuaUtil::deserialize(sol::state&, std::basic_string_view<char, std::char_traits<char> >, LuaUtil::UserdataSerializer const*) /home/elsid/dev/openmw/components/lua/serialization.cpp:251
    openscenegraph#4 0x562ea6464d96 in TestBody /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:197
    openscenegraph#5 0x562ea6d9dac6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    openscenegraph#6 0x562ea6d9dac6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    openscenegraph#7 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2682
    openscenegraph#8 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2672
    openscenegraph#9 0x562ea6d93024 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2861
    openscenegraph#10 0x562ea6d93728 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2834
    openscenegraph#11 0x562ea6d93728 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:3015
    openscenegraph#12 0x562ea6d94142 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2994
    openscenegraph#13 0x562ea6d94142 in testing::internal::UnitTestImpl::RunAllTests() /home/elsid/dev/googletest/googletest/src/gtest.cc:5855
    openscenegraph#14 0x562ea6d9e096 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    openscenegraph#15 0x562ea6d9e096 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    openscenegraph#16 0x562ea6d93140 in testing::UnitTest::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:5438
    openscenegraph#17 0x562ea5d3fdc6 in RUN_ALL_TESTS() /home/elsid/dev/googletest/build/gcc/release/install/include/gtest/gtest.h:2490
    openscenegraph#18 0x562ea5d3fc6f in main /home/elsid/dev/openmw/apps/openmw_test_suite/openmw_test_suite.cpp:11
    openscenegraph#19 0x7fe3938d0b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    openscenegraph#20 0x562ea5d3fb7d in _start (/home/elsid/dev/openmw/build/gcc/ubsan/openmw_test_suite+0x173eb7d)
Nika-Keks pushed a commit to Nika-Keks/OpenSceneGraph that referenced this issue Jun 15, 2022
To fix TSAN warning:

WARNING: ThreadSanitizer: data race (pid=68597)
  Write of size 1 at 0x7b3800079234 by main thread:
    #0 SceneUtil::WorkQueue::start(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:51 (openmw+0x10daa10)
    openscenegraph#1 SceneUtil::WorkQueue::WorkQueue(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:39 (openmw+0x10dad97)
    openscenegraph#2 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb5a)
    openscenegraph#3 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    openscenegraph#4 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    openscenegraph#5 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    openscenegraph#6 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)

  Previous read of size 1 at 0x7b3800079234 by thread T10 (mutexes: write M19275778865205896):
    #0 SceneUtil::WorkQueue::removeWorkItem() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:86 (openmw+0x10d9e51)
    openscenegraph#1 SceneUtil::WorkThread::run() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:127 (openmw+0x10da52a)
    openscenegraph#2 operator() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:114 (openmw+0x10da664)
    openscenegraph#3 __invoke_impl<void, SceneUtil::WorkThread::WorkThread(SceneUtil::WorkQueue&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61 (openmw+0x10da664)
    openscenegraph#4 __invoke<SceneUtil::WorkThread::WorkThread(SceneUtil::WorkQueue&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96 (openmw+0x10da664)
    openscenegraph#5 _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253 (openmw+0x10da664)
    openscenegraph#6 operator() /usr/include/c++/11.1.0/bits/std_thread.h:260 (openmw+0x10da664)
    openscenegraph#7 _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211 (openmw+0x10da664)
    openscenegraph#8 execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82 (libstdc++.so.6+0xd33c3)

  Location is heap block of size 216 at 0x7b3800079220 allocated by main thread:
    #0 operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x91824)
    openscenegraph#1 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb4c)
    openscenegraph#2 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    openscenegraph#3 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    openscenegraph#4 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    openscenegraph#5 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)

  Mutex M19275778865205896 is already destroyed.

  Thread T10 (tid=68609, running) created by main thread at:
    #0 pthread_create /build/gcc/src/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x61c3a)
    openscenegraph#1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xd36aa)
    openscenegraph#2 std::_MakeUniq<SceneUtil::WorkThread>::__single_object std::make_unique<SceneUtil::WorkThread, SceneUtil::WorkQueue&>(SceneUtil::WorkQueue&) /usr/include/c++/11.1.0/bits/unique_ptr.h:962 (openmw+0x10da987)
    openscenegraph#3 SceneUtil::WorkQueue::start(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:50 (openmw+0x10da987)
    openscenegraph#4 SceneUtil::WorkQueue::WorkQueue(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:39 (openmw+0x10dad97)
    openscenegraph#5 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb5a)
    openscenegraph#6 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    openscenegraph#7 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    openscenegraph#8 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    openscenegraph#9 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)
Nika-Keks pushed a commit to Nika-Keks/OpenSceneGraph that referenced this issue Jun 15, 2022
To fix ASAN warning:
=11799==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000436058 at pc 0x55c90acccaa8 bp 0x7f787eeac830 sp 0x7f787eeac820
READ of size 8 at 0x60c000436058 thread T18
    #0 0x55c90acccaa7 in std::operator==(std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&, std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&) /usr/include/c++/11.1.0/bits/stl_deque.h:269
    openscenegraph#1 0x55c90acccaa7 in std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >::empty() const /usr/include/c++/11.1.0/bits/stl_deque.h:1311
    openscenegraph#2 0x55c90acccaa7 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:350
    openscenegraph#3 0x55c90acccaa7 in wait_until<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> >, DetourNavigator::AsyncNavMeshUpdater::getNextJob()::<lambda()> > /usr/include/c++/11.1.0/condition_variable:151
    openscenegraph#4 0x55c90acccaa7 in wait_for<long int, std::ratio<1, 1000>, DetourNavigator::AsyncNavMeshUpdater::getNextJob()::<lambda()> > /usr/include/c++/11.1.0/condition_variable:175
    openscenegraph#5 0x55c90acccaa7 in DetourNavigator::AsyncNavMeshUpdater::getNextJob() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:353
    openscenegraph#6 0x55c90accdb2d in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:257
    openscenegraph#7 0x55c90acce464 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:98
    openscenegraph#8 0x55c90acce464 in __invoke_impl<void, DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61
    openscenegraph#9 0x55c90acce464 in __invoke<DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96
    openscenegraph#10 0x55c90acce464 in _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253
    openscenegraph#11 0x55c90acce464 in operator() /usr/include/c++/11.1.0/bits/std_thread.h:260
    openscenegraph#12 0x55c90acce464 in _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211
    openscenegraph#13 0x7f78c38fd3c3 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82
    openscenegraph#14 0x7f78c36b1258 in start_thread (/usr/lib/libpthread.so.0+0x9258)
    openscenegraph#15 0x7f78c35da5e2 in __GI___clone (/usr/lib/libc.so.6+0xfe5e2)

0x60c000436058 is located 88 bytes inside of 120-byte region [0x60c000436000,0x60c000436078)
freed by thread T0 here:
    #0 0x7f78c688cd69 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172
    openscenegraph#1 0x55c90acdbe20 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::deallocate(std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*, unsigned long) /usr/include/c++/11.1.0/ext/new_allocator.h:139
    openscenegraph#2 0x55c90acdbe20 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > > >::deallocate(std::allocator<std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >&, std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:492
    openscenegraph#3 0x55c90acdbe20 in std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_put_node(std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:565
    openscenegraph#4 0x55c90acdbe20 in std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:632
    openscenegraph#5 0x55c90acdbe20 in std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    openscenegraph#6 0x55c90acc0569 in std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::clear() /usr/include/c++/11.1.0/bits/stl_tree.h:1254
    openscenegraph#7 0x55c90acc0569 in std::map<std::thread::id, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::clear() /usr/include/c++/11.1.0/bits/stl_map.h:1134
    openscenegraph#8 0x55c90acc0569 in DetourNavigator::AsyncNavMeshUpdater::~AsyncNavMeshUpdater() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:105
    openscenegraph#9 0x55c90acab2dc in DetourNavigator::NavigatorImpl::~NavigatorImpl() (/home/elsid/dev/openmw/build/gcc/asan/openmw+0x2d152dc)
    openscenegraph#10 0x55c9097db4b5 in std::default_delete<DetourNavigator::Navigator>::operator()(DetourNavigator::Navigator*) const /usr/include/c++/11.1.0/bits/unique_ptr.h:85
    openscenegraph#11 0x55c9097db4b5 in std::unique_ptr<DetourNavigator::Navigator, std::default_delete<DetourNavigator::Navigator> >::~unique_ptr() /usr/include/c++/11.1.0/bits/unique_ptr.h:361
    openscenegraph#12 0x55c9097db4b5 in MWWorld::World::~World() /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:534
    openscenegraph#13 0x55c9097dc3a4 in MWWorld::World::~World() /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:534
    openscenegraph#14 0x55c90a1925e4 in MWBase::Environment::cleanup() /home/elsid/dev/openmw/apps/openmw/mwbase/environment.cpp:192
    openscenegraph#15 0x55c90a1f544d in OMW::Engine::~Engine() /home/elsid/dev/openmw/apps/openmw/engine.cpp:434
    openscenegraph#16 0x55c90a1f6700 in OMW::Engine::~Engine() /home/elsid/dev/openmw/apps/openmw/engine.cpp:455
    openscenegraph#17 0x55c90a19d523 in std::default_delete<OMW::Engine>::operator()(OMW::Engine*) const /usr/include/c++/11.1.0/bits/unique_ptr.h:85
    openscenegraph#18 0x55c90a19d523 in std::unique_ptr<OMW::Engine, std::default_delete<OMW::Engine> >::~unique_ptr() /usr/include/c++/11.1.0/bits/unique_ptr.h:361
    openscenegraph#19 0x55c90a19d523 in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:320
    openscenegraph#20 0x55c90a955634 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    openscenegraph#21 0x55c90a193be0 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    openscenegraph#22 0x7f78c3503b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

previously allocated by thread T18 here:
    #0 0x7f78c688bca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    openscenegraph#1 0x55c90ace8c73 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::allocate(unsigned long, void const*) /usr/include/c++/11.1.0/ext/new_allocator.h:121
    openscenegraph#2 0x55c90ace8c73 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >&, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:460
    openscenegraph#3 0x55c90ace8c73 in std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_get_node() /usr/include/c++/11.1.0/bits/stl_tree.h:561
    openscenegraph#4 0x55c90ace8c73 in std::_Rb_tree_node<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >* std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<std::thread::id const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<std::thread::id const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:611
    openscenegraph#5 0x55c90ace8c73 in std::_Rb_tree_iterator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > std::_Rb_tree<std::thread::id, std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::thread::id const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::piecewise_construct_t const&, std::tuple<std::thread::id const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:2429
    openscenegraph#6 0x55c90accc5fb in std::map<std::thread::id, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >, std::less<std::thread::id>, std::allocator<std::pair<std::thread::id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::operator[](std::thread::id const&) /usr/include/c++/11.1.0/bits/stl_map.h:501
    openscenegraph#7 0x55c90accc5fb in DetourNavigator::AsyncNavMeshUpdater::getNextJob() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:344
    openscenegraph#8 0x55c90accdb2d in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:257
    openscenegraph#9 0x55c90acce464 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:98
    openscenegraph#10 0x55c90acce464 in __invoke_impl<void, DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61
    openscenegraph#11 0x55c90acce464 in __invoke<DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96
    openscenegraph#12 0x55c90acce464 in _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253
    openscenegraph#13 0x55c90acce464 in operator() /usr/include/c++/11.1.0/bits/std_thread.h:260
    openscenegraph#14 0x55c90acce464 in _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211
    openscenegraph#15 0x7f78c38fd3c3 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82

Thread T18 created by T0 here:
    #0 0x7f78c682bfa7 in __interceptor_pthread_create /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cpp:216
    openscenegraph#1 0x7f78c38fd6aa in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663
    openscenegraph#2 0x55c90ae008d1 in DetourNavigator::NavMeshManager::NavMeshManager(DetourNavigator::Settings const&) /home/elsid/dev/openmw/components/detournavigator/navmeshmanager.cpp:47
    openscenegraph#3 0x55c90aca3bfe in DetourNavigator::NavigatorImpl::NavigatorImpl(DetourNavigator::Settings const&) /home/elsid/dev/openmw/components/detournavigator/navigatorimpl.cpp:13
    openscenegraph#4 0x55c9097d9e6f in MWWorld::World::World(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, Files::Collections const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ToUTF8::Utf8Encoder*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:196
    openscenegraph#5 0x55c90a1e9992 in OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:789
    openscenegraph#6 0x55c90a1ed138 in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949
    openscenegraph#7 0x55c90a19d4cb in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316
    openscenegraph#8 0x55c90a955634 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    openscenegraph#9 0x55c90a193be0 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    openscenegraph#10 0x7f78c3503b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/11.1.0/bits/stl_deque.h:269 in std::operator==(std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&, std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&)
Shadow bytes around the buggy address:
  0x0c188007ebb0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c188007ebc0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c188007ebd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c188007ebe0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ebf0: 00 00 00 00 00 00 07 fa fa fa fa fa fa fa fa fa
=>0x0c188007ec00: fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fa
  0x0c188007ec10: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ec20: 00 00 00 00 00 00 02 fa fa fa fa fa fa fa fa fa
  0x0c188007ec30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c188007ec40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ec50: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
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
==11799==ABORTING
Nika-Keks pushed a commit to Nika-Keks/OpenSceneGraph that referenced this issue Jun 15, 2022
To prevent crash:
==7733==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040000ca1b0 at pc 0x55fcfa8d1ee3 bp 0x7ffd1c464e00 sp 0x7ffd1c464df0
READ of size 4 at 0x6040000ca1b0 thread T0
    #0 0x55fcfa8d1ee2 in std::less<unsigned int>::operator()(unsigned int const&, unsigned int const&) const /usr/include/c++/11.1.0/bits/stl_function.h:386
    openscenegraph#1 0x55fcfa8d1ee2 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_lower_bound(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*, std::_Rb_tree_node_base*, unsigned int const&) /usr/include/c++/11.1.0/bits/stl_tree.h:1903
    openscenegraph#2 0x55fcfa8ca76e in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::lower_bound(unsigned int const&) /usr/include/c++/11.1.0/bits/stl_tree.h:1270
    openscenegraph#3 0x55fcfa8ca76e in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::lower_bound(unsigned int const&) /usr/include/c++/11.1.0/bits/stl_map.h:1259
    openscenegraph#4 0x55fcfa8ca76e in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::operator[](unsigned int const&) /usr/include/c++/11.1.0/bits/stl_map.h:497
    openscenegraph#5 0x55fcfa8ca76e in osg::getOrCreateContextData(unsigned int) /home/elsid/dev/OpenSceneGraph/src/osg/ContextData.cpp:142
    openscenegraph#6 0x55fcfab6848a in GLShaderManager* osg::get<GLShaderManager>(unsigned int) /home/elsid/dev/OpenSceneGraph/include/osg/ContextData:154
    openscenegraph#7 0x55fcfab6848a in osg::Shader::PerContextShader::~PerContextShader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:540
    openscenegraph#8 0x55fcfab68dc6 in osg::Shader::PerContextShader::~PerContextShader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:541
    openscenegraph#9 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#10 0x55fcfab6d0ce in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    openscenegraph#11 0x55fcfab6d0ce in osg::ref_ptr<osg::Shader::PerContextShader>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    openscenegraph#12 0x55fcfab6d0ce in void std::_Destroy<osg::ref_ptr<osg::Shader::PerContextShader> >(osg::ref_ptr<osg::Shader::PerContextShader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:140
    openscenegraph#13 0x55fcfab6d0ce in void std::_Destroy_aux<false>::__destroy<osg::ref_ptr<osg::Shader::PerContextShader>*>(osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:152
    openscenegraph#14 0x55fcfab6d0ce in void std::_Destroy<osg::ref_ptr<osg::Shader::PerContextShader>*>(osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:185
    openscenegraph#15 0x55fcfab6d0ce in void std::_Destroy<osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader> >(osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader>*, std::allocator<osg::ref_ptr<osg::Shader::PerContextShader> >&) /usr/include/c++/11.1.0/bits/alloc_traits.h:746
    openscenegraph#16 0x55fcfab6d0ce in std::vector<osg::ref_ptr<osg::Shader::PerContextShader>, std::allocator<osg::ref_ptr<osg::Shader::PerContextShader> > >::~vector() /usr/include/c++/11.1.0/bits/stl_vector.h:680
    openscenegraph#17 0x55fcfab6d0ce in osg::Shader::ShaderObjects::~ShaderObjects() /home/elsid/dev/OpenSceneGraph/include/osg/Shader:264
    openscenegraph#18 0x55fcfab6d0ce in osg::Shader::ShaderObjects::~ShaderObjects() /home/elsid/dev/OpenSceneGraph/include/osg/Shader:264
    openscenegraph#19 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#20 0x55fcfab6c532 in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    openscenegraph#21 0x55fcfab6c532 in osg::ref_ptr<osg::Shader::ShaderObjects>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    openscenegraph#22 0x55fcfab6c532 in void std::_Destroy<osg::ref_ptr<osg::Shader::ShaderObjects> >(osg::ref_ptr<osg::Shader::ShaderObjects>*) /usr/include/c++/11.1.0/bits/stl_construct.h:140
    openscenegraph#23 0x55fcfab6c532 in void std::_Destroy_aux<false>::__destroy<osg::ref_ptr<osg::Shader::ShaderObjects>*>(osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects>*) /usr/include/c++/11.1.0/bits/stl_construct.h:152
    openscenegraph#24 0x55fcfab6c532 in void std::_Destroy<osg::ref_ptr<osg::Shader::ShaderObjects>*>(osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects>*) /usr/include/c++/11.1.0/bits/stl_construct.h:185
    openscenegraph#25 0x55fcfab6c532 in void std::_Destroy<osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects> >(osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects>*, std::allocator<osg::ref_ptr<osg::Shader::ShaderObjects> >&) /usr/include/c++/11.1.0/bits/alloc_traits.h:746
    openscenegraph#26 0x55fcfab6c532 in std::vector<osg::ref_ptr<osg::Shader::ShaderObjects>, std::allocator<osg::ref_ptr<osg::Shader::ShaderObjects> > >::~vector() /usr/include/c++/11.1.0/bits/stl_vector.h:680
    openscenegraph#27 0x55fcfab6c532 in osg::buffered_value<osg::ref_ptr<osg::Shader::ShaderObjects> >::~buffered_value() /home/elsid/dev/OpenSceneGraph/include/osg/buffered_value:26
    openscenegraph#28 0x55fcfab6c532 in osg::Shader::~Shader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:271
    openscenegraph#29 0x55fcfab6c80a in osg::Shader::~Shader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:271
    openscenegraph#30 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#31 0x55fcfab185bd in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    openscenegraph#32 0x55fcfab185bd in osg::ref_ptr<osg::Shader>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    openscenegraph#33 0x55fcfab185bd in void std::_Destroy<osg::ref_ptr<osg::Shader> >(osg::ref_ptr<osg::Shader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:140
    openscenegraph#34 0x55fcfab185bd in void std::_Destroy_aux<false>::__destroy<osg::ref_ptr<osg::Shader>*>(osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:152
    openscenegraph#35 0x55fcfab185bd in void std::_Destroy<osg::ref_ptr<osg::Shader>*>(osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:185
    openscenegraph#36 0x55fcfab185bd in void std::_Destroy<osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader> >(osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader>*, std::allocator<osg::ref_ptr<osg::Shader> >&) /usr/include/c++/11.1.0/bits/alloc_traits.h:746
    openscenegraph#37 0x55fcfab185bd in std::vector<osg::ref_ptr<osg::Shader>, std::allocator<osg::ref_ptr<osg::Shader> > >::~vector() /usr/include/c++/11.1.0/bits/stl_vector.h:680
    openscenegraph#38 0x55fcfab185bd in osg::Program::~Program() /home/elsid/dev/OpenSceneGraph/src/osg/Program.cpp:147
    openscenegraph#39 0x55fcfab18ae0 in osg::Program::~Program() /home/elsid/dev/OpenSceneGraph/src/osg/Program.cpp:147
    openscenegraph#40 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#41 0x55fcf8582cfa in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/Referenced:201
    openscenegraph#42 0x55fcf8582cfa in osg::ref_ptr<osg::StateAttribute>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/ref_ptr:44
    openscenegraph#43 0x55fcf8582cfa in std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int>::~pair() /usr/include/c++/11.1.0/bits/stl_pair.h:211
    openscenegraph#44 0x55fcf8582cfa in std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >::~pair() /usr/include/c++/11.1.0/bits/stl_pair.h:211
    openscenegraph#45 0x55fcf8582cfa in void __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::destroy<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >(std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >*) /usr/include/c++/11.1.0/ext/new_allocator.h:162
    openscenegraph#46 0x55fcf8582cfa in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > > >::destroy<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >(std::allocator<std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >&, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >*) /usr/include/c++/11.1.0/bits/alloc_traits.h:531
    openscenegraph#47 0x55fcf8582cfa in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::_M_destroy_node(std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:623
    openscenegraph#48 0x55fcf8582cfa in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:631
    openscenegraph#49 0x55fcf8582cfa in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    openscenegraph#50 0x55fcfac1f281 in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::clear() /usr/include/c++/11.1.0/bits/stl_tree.h:1254
    openscenegraph#51 0x55fcfac1f281 in std::map<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int>, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::clear() /usr/include/c++/11.1.0/bits/stl_map.h:1134
    openscenegraph#52 0x55fcfac1f281 in osg::StateSet::clear() /home/elsid/dev/OpenSceneGraph/src/osg/StateSet.cpp:738
    openscenegraph#53 0x55fcfac2079e in osg::StateSet::~StateSet() /home/elsid/dev/OpenSceneGraph/src/osg/StateSet.cpp:285
    openscenegraph#54 0x55fcfac20d3e in osg::StateSet::~StateSet() /home/elsid/dev/OpenSceneGraph/src/osg/StateSet.cpp:286
    openscenegraph#55 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#56 0x55fcfb20dcac in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/Referenced:201
    openscenegraph#57 0x55fcfb20dcac in osg::ref_ptr<osg::StateSet>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/ref_ptr:44
    openscenegraph#58 0x55fcfb20dcac in std::array<osg::ref_ptr<osg::StateSet>, 8ul>::~array() /usr/include/c++/11.1.0/array:95
    openscenegraph#59 0x55fcfb20dcac in SceneUtil::ShadowsBin::~ShadowsBin() /home/elsid/dev/openmw/components/sceneutil/shadowsbin.hpp:16
    openscenegraph#60 0x55fcfb20dcac in SceneUtil::ShadowsBin::~ShadowsBin() /home/elsid/dev/openmw/components/sceneutil/shadowsbin.hpp:16
    openscenegraph#61 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#62 0x55fcfa6cc17f in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    openscenegraph#63 0x55fcfa6cc17f in osg::ref_ptr<osgUtil::RenderBin>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    openscenegraph#64 0x55fcfa6cc17f in std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >::~pair() /usr/include/c++/11.1.0/bits/stl_pair.h:211
    openscenegraph#65 0x55fcfa6cc17f in void __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::destroy<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >*) /usr/include/c++/11.1.0/ext/new_allocator.h:162
    openscenegraph#66 0x55fcfa6cc17f in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > > >::destroy<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >&, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >*) /usr/include/c++/11.1.0/bits/alloc_traits.h:531
    openscenegraph#67 0x55fcfa6cc17f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_destroy_node(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:623
    openscenegraph#68 0x55fcfa6cc17f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:631
    openscenegraph#69 0x55fcfa6cc17f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    openscenegraph#70 0x55fcfa6cc122 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1887
    openscenegraph#71 0x55fcfa6cc122 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1887
    openscenegraph#72 0x55fcfa6cc245 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::~_Rb_tree() /usr/include/c++/11.1.0/bits/stl_tree.h:984
    openscenegraph#73 0x55fcfa6cc245 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, osg::ref_ptr<osgUtil::RenderBin>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::~map() /usr/include/c++/11.1.0/bits/stl_map.h:302
    openscenegraph#74 0x55fcfa6cc245 in RenderBinPrototypeList::~RenderBinPrototypeList() /home/elsid/dev/OpenSceneGraph/src/osgUtil/RenderBin.cpp:48
    openscenegraph#75 0x55fcfa6cc245 in RenderBinPrototypeList::~RenderBinPrototypeList() /home/elsid/dev/OpenSceneGraph/src/osgUtil/RenderBin.cpp:48
    openscenegraph#76 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    openscenegraph#77 0x55fcfa6cbcc1 in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    openscenegraph#78 0x55fcfa6cbcc1 in osg::ref_ptr<RenderBinPrototypeList>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    openscenegraph#79 0x7f3977bd04a6 in __run_exit_handlers (/usr/lib/libc.so.6+0x3f4a6)
    openscenegraph#80 0x7f3977bd064d in exit (/usr/lib/libc.so.6+0x3f64d)
    openscenegraph#81 0x7f3977bb8b2b in __libc_start_main (/usr/lib/libc.so.6+0x27b2b)
    openscenegraph#82 0x55fcf81ea12d in _start (/home/elsid/dev/openmw/build/gcc/asan/openmw+0xa4412d)

0x6040000ca1b0 is located 32 bytes inside of 48-byte region [0x6040000ca190,0x6040000ca1c0)
freed by thread T0 here:
    #0 0x7f397a633d69 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172
    openscenegraph#1 0x55fcfa8d1824 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::deallocate(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*, unsigned long) /usr/include/c++/11.1.0/ext/new_allocator.h:139
    openscenegraph#2 0x55fcfa8d1824 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > > >::deallocate(std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >&, std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:492
    openscenegraph#3 0x55fcfa8d1824 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_put_node(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:565
    openscenegraph#4 0x55fcfa8d1824 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_drop_node(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:632
    openscenegraph#5 0x55fcfa8d1824 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    openscenegraph#6 0x55fcfa8d18da in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::~_Rb_tree() /usr/include/c++/11.1.0/bits/stl_tree.h:984
    openscenegraph#7 0x55fcfa8d18da in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::~map() /usr/include/c++/11.1.0/bits/stl_map.h:302
    openscenegraph#8 0x7f3977bd04a6 in __run_exit_handlers (/usr/lib/libc.so.6+0x3f4a6)

previously allocated by thread T0 here:
    #0 0x7f397a632ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    openscenegraph#1 0x55fcfa8d3aa1 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::allocate(unsigned long, void const*) /usr/include/c++/11.1.0/ext/new_allocator.h:121
    openscenegraph#2 0x55fcfa8d3aa1 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >&, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:460
    openscenegraph#3 0x55fcfa8d3aa1 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_get_node() /usr/include/c++/11.1.0/bits/stl_tree.h:561
    openscenegraph#4 0x55fcfa8d3aa1 in std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >* std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<unsigned int const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<unsigned int const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:611
    openscenegraph#5 0x55fcfa8d3aa1 in std::_Rb_tree_iterator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<unsigned int const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::piecewise_construct_t const&, std::tuple<unsigned int const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:2429
    openscenegraph#6 0x55fcfa8cfd91 in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::operator[](unsigned int const&) /usr/include/c++/11.1.0/bits/stl_map.h:501
    openscenegraph#7 0x55fcfa8cfd91 in osg::ContextData::createNewContextID() /home/elsid/dev/OpenSceneGraph/src/osg/ContextData.cpp:171
    openscenegraph#8 0x55fcfa9be218 in osg::GraphicsContext::createNewContextID() /home/elsid/dev/OpenSceneGraph/src/osg/GraphicsContext.cpp:320
    openscenegraph#9 0x55fcfb68d1ef in SDLUtil::GraphicsWindowSDL2::GraphicsWindowSDL2(osg::GraphicsContext::Traits*) /home/elsid/dev/openmw/components/sdlutil/sdlgraphicswindow.cpp:39
    openscenegraph#10 0x55fcfa17f93a in OMW::Engine::createWindow(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:611
    openscenegraph#11 0x55fcfa18398f in OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:679
    openscenegraph#12 0x55fcfa18c4f2 in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949
    openscenegraph#13 0x55fcfa13c9ff in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316
    openscenegraph#14 0x55fcfb49f562 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    openscenegraph#15 0x55fcfa133114 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    openscenegraph#16 0x7f3977bb8b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/11.1.0/bits/stl_function.h:386 in std::less<unsigned int>::operator()(unsigned int const&, unsigned int const&) const
Shadow bytes around the buggy address:
  0x0c08800113e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c08800113f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011410: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011420: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c0880011430: fa fa fd fd fd fd[fd]fd fa fa fa fa fa fa fa fa
  0x0c0880011440: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011450: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011460: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011470: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==7733==ABORTING
Nika-Keks pushed a commit to Nika-Keks/OpenSceneGraph that referenced this issue Jun 15, 2022
=================================================================
==20931==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000206030 at pc 0x7fc8b0f3a72b bp 0x7ffcee176860 sp 0x7ffcee176008
READ of size 13 at 0x607000206030 thread T0
    #0 0x7fc8b0f3a72a in __interceptor_strlen /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:389
    openscenegraph#1 0x562e069a0af7 in QString::fromUtf8(char const*, int) /usr/include/qt/QtCore/qstring.h:706
    openscenegraph#2 0x562e069a0af7 in Launcher::AdvancedPage::AdvancedPage(Config::GameSettings&, QWidget*) /home/elsid/dev/openmw/apps/launcher/advancedpage.cpp:29
    openscenegraph#3 0x562e06959613 in Launcher::MainDialog::createPages() /home/elsid/dev/openmw/apps/launcher/maindialog.cpp:127
    openscenegraph#4 0x562e069691d2 in Launcher::MainDialog::setup() /home/elsid/dev/openmw/apps/launcher/maindialog.cpp:228
    openscenegraph#5 0x562e06969d88 in Launcher::MainDialog::showFirstRunDialog() /home/elsid/dev/openmw/apps/launcher/maindialog.cpp:188
    openscenegraph#6 0x562e06957025 in main /home/elsid/dev/openmw/apps/launcher/main.cpp:35
    openscenegraph#7 0x7fc8ad0d9b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    openscenegraph#8 0x562e0690fced in _start (/home/elsid/dev/openmw/build/gcc/asan/openmw-launcher+0x56ced)

0x607000206030 is located 16 bytes inside of 64-byte region [0x607000206020,0x607000206060)
freed by thread T0 here:
    #0 0x7fc8b0fb3f19 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127
    openscenegraph#1 0x7fc8b0de3388  (/usr/lib/libopenal.so.1+0x40388)

previously allocated by thread T0 here:
    #0 0x7fc8b0fb4fd6 in __interceptor_posix_memalign /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:226
    openscenegraph#1 0x7fc8b0e379cb  (/usr/lib/libopenal.so.1+0x949cb)

SUMMARY: AddressSanitizer: heap-use-after-free /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:389 in __interceptor_strlen
Shadow bytes around the buggy address:
  0x0c0e80038bb0: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa 00 00
  0x0c0e80038bc0: 00 00 00 00 00 00 00 fa fa fa fa fa 00 00 00 00
  0x0c0e80038bd0: 00 00 00 00 00 fa fa fa fa fa 00 00 00 00 00 00
  0x0c0e80038be0: 00 00 02 fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c0e80038bf0: 02 fa fa fa fa fa fd fd fd fd fd fd fd fd fa fa
=>0x0c0e80038c00: fa fa fa fa fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x0c0e80038c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e80038c20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e80038c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e80038c40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e80038c50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==20931==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants