[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Reid Spencer reid at x10sys.com
Mon Apr 16 13:31:27 PDT 2007



Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.341 -> 1.342
---
Log message:

Check length of string before we walk off the end of it.
Thanks, Chris.


---
Diffs of the changes:  (+3 -3)

 llvmAsmParser.y |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.341 llvm/lib/AsmParser/llvmAsmParser.y:1.342
--- llvm/lib/AsmParser/llvmAsmParser.y:1.341	Mon Apr 16 12:45:50 2007
+++ llvm/lib/AsmParser/llvmAsmParser.y	Mon Apr 16 15:31:06 2007
@@ -2823,9 +2823,9 @@
 
     // Check for call to invalid intrinsic to avoid crashing later.
     if (Function *theF = dyn_cast<Function>(V)) {
-      if (theF->hasName() && 
-          0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5) &&
-        !theF->getIntrinsicID(true))
+      if (theF->hasName() && (strlen(theF->getValueName()->getKeyData()) >= 5)&&
+          (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
+          !theF->getIntrinsicID(true))
         GEN_ERROR("Call to invalid LLVM intrinsic function '" +
                   theF->getName() + "'");
     }






More information about the llvm-commits mailing list