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

Chris Lattner clattner at apple.com
Mon Apr 16 14:33:53 PDT 2007


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

<quoting reid>but I want to support nul characters in my names!</>

-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() + "'");
>      }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list