[llvm-commits] [llvm] r58031 - /llvm/branches/release_24/include/llvm/ADT/StringExtras.h

Tanya Lattner tonic at nondot.org
Wed Oct 22 22:01:32 PDT 2008


Author: tbrethou
Date: Thu Oct 23 00:01:25 2008
New Revision: 58031

URL: http://llvm.org/viewvc/llvm-project?rev=58031&view=rev
Log:
Merge from mainline
Fix incorrect testing for the end of the both strings in CStrInCStrNoCase.  This could cause a read-out-of-bounds error if s2 is smaller than s1.

Modified:
    llvm/branches/release_24/include/llvm/ADT/StringExtras.h

Modified: llvm/branches/release_24/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/include/llvm/ADT/StringExtras.h?rev=58031&r1=58030&r2=58031&view=diff

==============================================================================
--- llvm/branches/release_24/include/llvm/ADT/StringExtras.h (original)
+++ llvm/branches/release_24/include/llvm/ADT/StringExtras.h Thu Oct 23 00:01:25 2008
@@ -156,7 +156,7 @@
   
   const char *I1=s1, *I2=s2;
   
-  while (*I1 != '\0' || *I2 != '\0' )
+  while (*I1 != '\0' && *I2 != '\0' )
     if (tolower(*I1) != tolower(*I2)) { // No match.  Start over.
       ++s1; I1 = s1; I2 = s2;
     }





More information about the llvm-commits mailing list