wsd: fix crash with read-only documents + uno command without param

==15956==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000007cd2f7 bp 0x7ffe96c7cd70 sp 0x7ffe96c7c4e8 T0)
...
    #7 0x11a9d31 in ClientSession::filterMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const wsd/ClientSession.cpp:977:27
    #8 0x11925d6 in ClientSession::_handleInput(char const*, int) wsd/ClientSession.cpp:741:14
    #9 0x19395d0 in Session::handleMessage(bool, WSOpCode, std::vector<char, std::allocator<char> >&) common/Session.cpp:230:13

This seems to be a recurring pattern, I'll consider reworking
LOOLProtocol::tokenize() in a follow-up commit to have a return value
that is safer than std::vector<std::string>.

Change-Id: I0e71214a55af2e71e4787cb0dba0ddf7825bf9d9
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89637
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
distro/collabora/co-4-2-1
Miklos Vajna 2020-02-27 15:34:52 +01:00
parent ade9bcb454
commit d129979822
2 changed files with 1 additions and 1 deletions

View File

@ -974,7 +974,7 @@ bool ClientSession::filterMessage(const std::string& message) const
}
else if (tokens[0] == "uno")
{
if (tokens[1] == ".uno:ExecuteSearch")
if (tokens.size() > 1 && tokens[1] == ".uno:ExecuteSearch")
{
allowed = true;
}