Skip to content

Commit d95c406

Browse files
committed
[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
1 parent f0d87df commit d95c406

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info2(void *gdb_objc_realized_classes_ptr
199199
DEBUG_PRINTF ("count = %u\n", count);
200200
201201
uint32_t idx = 0;
202-
for (uint32_t i=0; i<=count; ++i)
202+
for (uint32_t i=0; i<count; ++i)
203203
{
204204
if (idx < max_class_infos)
205205
{
@@ -273,7 +273,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info3(void *gdb_objc_realized_classes_ptr
273273
DEBUG_PRINTF ("count = %u\n", count);
274274
275275
uint32_t idx = 0;
276-
for (uint32_t i=0; i<=count; ++i)
276+
for (uint32_t i=0; i<count; ++i)
277277
{
278278
if (idx < max_class_infos)
279279
{

0 commit comments

Comments
 (0)