From b9e21b5ec5fa06c278698ec3b77768ffe564106d Mon Sep 17 00:00:00 2001 From: Maximo Bautista Date: Tue, 11 Aug 2026 14:34:50 -0400 Subject: [PATCH] Handle UuidToStringA failure in GenerateRuntimeId Co-Authored-By: Claude Opus 5 (1M context) --- shared/src/native-src/util.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shared/src/native-src/util.cpp b/shared/src/native-src/util.cpp index cd8963337a2f..8f2b3d2034ba 100644 --- a/shared/src/native-src/util.cpp +++ b/shared/src/native-src/util.cpp @@ -285,8 +285,12 @@ namespace shared UUID uuid; UuidCreate(&uuid); - unsigned char* str; - UuidToStringA(&uuid, &str); + unsigned char* str = nullptr; + if (UuidToStringA(&uuid, &str) != RPC_S_OK) + { + // str is left untouched on failure, so there is nothing to free + return GenerateUuidV4(); + } std::string s((char*) str);