[Lldb-commits] [lldb] d95c406 - [lldb] Fix off-by-one error in the AppleObjCRuntimeV2 utility function
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 22 13:57:32 PDT 2022
Author: Jonas Devlieghere
Date: 2022-06-22T13:57:24-07:00
New Revision: d95c406c20ef8135fae74cc82406f498084749a0
URL: https://github.com/llvm/llvm-project/commit/d95c406c20ef8135fae74cc82406f498084749a0
DIFF: https://github.com/llvm/llvm-project/commit/d95c406c20ef8135fae74cc82406f498084749a0.diff
LOG: [lldb] Fix off-by-one error in the AppleObjCRuntimeV2 utility function
Fix an off-by-one error in the utility function used to extract the
dynamic class info. This resulted in a buffer overflow in the inferior
which interrupted our utility function.
Differential revision: https://reviews.llvm.org/D128377
Added:
Modified:
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 1b576f6870cc..f53b82ee33c8 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -199,7 +199,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info2(void *gdb_objc_realized_classes_ptr
DEBUG_PRINTF ("count = %u\n", count);
uint32_t idx = 0;
- for (uint32_t i=0; i<=count; ++i)
+ for (uint32_t i=0; i<count; ++i)
{
if (idx < max_class_infos)
{
@@ -273,7 +273,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info3(void *gdb_objc_realized_classes_ptr
DEBUG_PRINTF ("count = %u\n", count);
uint32_t idx = 0;
- for (uint32_t i=0; i<=count; ++i)
+ for (uint32_t i=0; i<count; ++i)
{
if (idx < max_class_infos)
{
More information about the lldb-commits
mailing list