https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/118995

Reported in #116944 / https://pvs-studio.com/en/blog/posts/cpp/1188/.

>From 6a227a0ee3e6b4c0091b94f69d348f155575192a Mon Sep 17 00:00:00 2001
From: David Spickett <david.spick...@linaro.org>
Date: Fri, 6 Dec 2024 16:21:51 +0000
Subject: [PATCH] [lldb] Fix off by one in array index check

Reported in #116944 / https://pvs-studio.com/en/blog/posts/cpp/1188/.
---
 .../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 0083b499656979..c43871b08191db 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -3278,7 +3278,7 @@ bool 
AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
       }
 
       // If the index is still out of range then this isn't a pointer.
-      if (index > m_indexed_isa_cache.size())
+      if (index >= m_indexed_isa_cache.size())
         return false;
 
       LLDB_LOGF(log, "AOCRT::NPI Evaluate(ret_isa = 0x%" PRIx64 ")",

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to