wsd/FileServer.cpp | 3 +++ 1 file changed, 3 insertions(+) New commits: commit d79666092d7d38eeea4fd18cea1c060e1fce7cdc Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu May 23 16:33:41 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu May 23 16:42:59 2019 +0200
wsd: avoid UB in FileServerRequestHandler::readDirToHash() wsd/FileServer.cpp:464:35: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/dirent.h:162:45: note: nonnull attribute specified here #0 0xbf566b in FileServerRequestHandler::readDirToHash(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/vmiklos/lode/dev/online/wsd/FileServer.cpp:464:27 #1 0xbf8417 in FileServerRequestHandler::initialize() /home/vmiklos/lode/dev/online/wsd/FileServer.cpp:531:13 #2 0x98617a in LOOLWSD::initialize(Poco::Util::Application&) /home/vmiklos/lode/dev/online/wsd/LOOLWSD.cpp:1155:5 #3 0x7f17fc9c8263 in Poco::Util::Application::run() (/usr/lib64/libPocoUtil.so.60+0x3e263) #4 0x9c29f3 in main /home/vmiklos/lode/dev/online/wsd/LOOLWSD.cpp:3466:1 #5 0x7f17fa739f49 in __libc_start_main (/lib64/libc.so.6+0x20f49) #6 0x5c1e19 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior wsd/FileServer.cpp:464:35 in Change-Id: Iadb90c4e98981283718be3e3e9f55cb0b7a3e917 diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp index 707e0b33d..cbdcea172 100644 --- a/wsd/FileServer.cpp +++ b/wsd/FileServer.cpp @@ -461,6 +461,9 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const LOG_TRC("Pre-reading directory: " << basePath << path); workingdir = opendir((basePath + path).c_str()); + if (!workingdir) + return; + while ((currentFile = readdir(workingdir)) != nullptr) { if (currentFile->d_name[0] == '.') _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits