This should fix a possible but very implausible heap-use-after-free issue in the LSP client.

This commit is contained in:
Martín Lucas Golini
2026-06-11 02:16:24 -03:00
parent 650bbed0c5
commit ff97358695
3 changed files with 8 additions and 1 deletions

View File

@@ -1291,6 +1291,9 @@ LSPClientServer::~LSPClientServer() {
for ( const auto& client : mClients )
client.first->unregisterClient( client.second.get() );
}
while ( mReadingStdOut || mReadingStdErr )
Sys::sleep( Milliseconds( 1 ) );
}
bool LSPClientServer::socketConnect() {
@@ -2119,6 +2122,7 @@ void LSPClientServer::processRequest( const json& msg ) {
}
void LSPClientServer::readStdOut( const char* bytes, size_t n ) {
BoolScopedOp op( mReadingStdOut );
if ( mEnded )
return;
mReceive.append( bytes, n );
@@ -2260,6 +2264,7 @@ void LSPClientServer::notifyServerError() {
}
void LSPClientServer::readStdErr( const char* bytes, size_t n ) {
BoolScopedOp op( mReadingStdErr );
if ( mEnded )
return;