From 117e16041ad4d6bcd82d73375cc17ecdbeb74186 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 26 Oct 2020 10:24:40 +0000 Subject: [PATCH] Add an error message and don't add child process for invalid ident --- renderdoc/core/core.cpp | 7 +++++++ renderdoc/os/posix/linux/linux_hook.cpp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index 5195fa972..86b854853 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -1726,6 +1726,13 @@ void RenderDoc::FinishCaptureWriting(RDCFile *rdc, uint32_t frameNumber) void RenderDoc::AddChildProcess(uint32_t pid, uint32_t ident) { + if(ident == 0 || ident == m_RemoteIdent) + { + RDCERR("Child process %u returned invalid ident %u. Possibly too many listen sockets in use!", + pid, ident); + return; + } + SCOPED_LOCK(m_ChildLock); m_Children.push_back(make_rdcpair(pid, ident)); } diff --git a/renderdoc/os/posix/linux/linux_hook.cpp b/renderdoc/os/posix/linux/linux_hook.cpp index ded7982b9..2c9f0b898 100644 --- a/renderdoc/os/posix/linux/linux_hook.cpp +++ b/renderdoc/os/posix/linux/linux_hook.cpp @@ -146,6 +146,9 @@ __attribute__((visibility("default"))) pid_t fork() usleep(1000); } + if(ident == ownIdent) + ident = 0; + RDCLOG("PID %u has ident %u", ret, ident); RenderDoc::Inst().AddChildProcess((uint32_t)ret, (uint32_t)ident);