[Lldb-commits] [lldb] [lldb] Fix wrong buffer size when fetching Objective-C classes (PR #197389)
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Fri May 15 03:33:54 PDT 2026
https://github.com/Teemperor updated https://github.com/llvm/llvm-project/pull/197389
>From 4f7ea26ce7b6e767e81ad3bf339d60737375665e Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Wed, 13 May 2026 09:37:16 +0100
Subject: [PATCH] [lldb] Fix wrong buffer size when fetching Objective-C
classes
LLDB calls objc_getRealizedClassList_trylock to fetch the list of
realized Objective-C classes.
Jim spotted that we currently pass the buffer length in *bytes*, when
actually this API takes the buffer length in number of elements. This
causes that the Objective-C runtime write more memory that we allocated
for it. This can cause that the function calling expression crashes
and leaves the Objective-C runtime mutex locked.
---
.../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 4ca179d927427..d6a0dd8a4b37b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2245,7 +2245,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(
if (class_buffer_addr != LLDB_INVALID_ADDRESS) {
arguments.GetValueAtIndex(index++)->GetScalar() = class_buffer_addr;
- arguments.GetValueAtIndex(index++)->GetScalar() = class_buffer_byte_size;
+ arguments.GetValueAtIndex(index++)->GetScalar() = class_buffer_len;
}
// Only dump the runtime classes from the expression evaluation if the log is
More information about the lldb-commits
mailing list