.gitreview | 2 +- wsd/LOOLWSD.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
New commits: commit fbe3458aa492df7786eaefeb5e782e2d894d9613 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Jan 22 08:52:55 2020 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Feb 12 16:27:26 2020 +0100 Fix an UB in the DocumentBroker dtor The problem is that both the DocBrokers map and the instance returned by Admin::instance() are static, so there it's not safe to assume that by the time the DocumentBroker dtor runs, the static Admin instance is still alive. Still, the DocumentBroker dtor calls Admin::instance(). Fix this by clearing the DocBrokers map in LOOLWSD::cleanup(), which is used exactly to destroy statics in a controlled order. Sanitizers output was: wsd/DocumentBroker.cpp:497:23: runtime error: member call on address 0x0000024a5ba0 which does not point to an object of type 'Admin' 0x0000024a5ba0: note: object is of type 'SocketPoll' 00 00 00 00 50 21 45 01 00 00 00 00 b8 5b 4a 02 00 00 00 00 05 00 00 00 00 00 00 00 61 64 6d 69 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'SocketPoll' #0 0xa10af3 in DocumentBroker::~DocumentBroker() wsd/DocumentBroker.cpp:497:23 ... #17 0x7fa27622ddc9 in exit (/lib64/libc.so.6+0x38dc9) #18 0x7fa276215f90 in __libc_start_main (/lib64/libc.so.6+0x20f90) #19 0x670189 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior wsd/DocumentBroker.cpp:497:23 in (Seen during make check CPPUNIT_TEST_NAME="unit-each-view".) Conflicts: wsd/LOOLWSD.cpp Change-Id: I02ad44deb9de06d9973216428c640248ea2512ce Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87178 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/.gitreview b/.gitreview index 489239f60..402f38775 100644 --- a/.gitreview +++ b/.gitreview @@ -3,5 +3,5 @@ host=logerrit port=29418 project=online defaultremote=logerrit -defaultbranch=distro/collabora/collabora-online-4 +defaultbranch=distro/collabora/collabora-online-4-0 diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 97b774cd0..44d43ae35 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -3392,6 +3392,10 @@ void LOOLWSD::cleanup() } #endif #endif + + // Delete these while the static Admin instance is still alive. + std::lock_guard<std::mutex> docBrokersLock(DocBrokersMutex); + DocBrokers.clear(); } int LOOLWSD::main(const std::vector<std::string>& /*args*/) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits