Author: David Spickett
Date: 2024-12-06T16:40:57Z
New Revision: a46ee733d244333785c0896ce399341fe30240b0

URL: 
https://github.com/llvm/llvm-project/commit/a46ee733d244333785c0896ce399341fe30240b0
DIFF: 
https://github.com/llvm/llvm-project/commit/a46ee733d244333785c0896ce399341fe30240b0.diff

LOG: [lldb] Fix off by one in array index check in Objective C runtime plugin 
(#118995)

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

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 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