Skip to content

Commit

Permalink
wsd: fix assert fail in DocumentBroker::getJailRoot()
Browse files Browse the repository at this point in the history
This can happen if the websocket incoming traffic has a load command,
followed by a removesession command, so asserting a non-empty jail ID
seems to be going too far.

Backtrace:

    #9 0x555e36ada9b8 in DocumentBroker::getJailRoot[abi:cxx11]() const wsd/DocumentBroker.cpp:3646:5
    #10 0x555e36b49ae3 in DocumentBroker::uploadPresetsToWopiHost(Authorization const&) wsd/DocumentBroker.cpp:4094:41
    #11 0x555e36b444c9 in DocumentBroker::removeSession(std::shared_ptr<ClientSession> const&) wsd/DocumentBroker.cpp:3772:9
    #12 0x555e369bb709 in ClientSession::_handleInput(char const*, int) ClientSession.cpp:1088:24
    #13 0x555e3703957b in Session::handleMessage(std::vector<char, std::allocator<char>> const&) common/Session.cpp

Signed-off-by: Miklos Vajna <[email protected]>
Change-Id: Ib9cfd4856838dfa6ba304888770898964e922260
  • Loading branch information
vmiklos authored and caolanm committed Jan 27, 2025
1 parent 841b69f commit c402f76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file not shown.
6 changes: 5 additions & 1 deletion wsd/DocumentBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3614,7 +3614,11 @@ bool DocumentBroker::sendUnoSave(const std::shared_ptr<ClientSession>& session,
std::string DocumentBroker::getJailRoot() const
{
#if !MOBILEAPP
assert(!_jailId.empty());
if (_jailId.empty())
{
LOG_WRN("Trying to get the jail root of a not yet downloaded document.");
return std::string();
}
return Poco::Path(COOLWSD::ChildRoot, _jailId).toString();
#else
return std::string();
Expand Down

0 comments on commit c402f76

Please sign in to comment.