[PATCH] Fix the argument index error of __builtin___memccpy_chk

Eric Christopher echristo at gmail.com
Tue Sep 23 16:11:23 PDT 2014


Testcase?

-eric

On Tue, Sep 23, 2014 at 4:03 PM, Steven Wu <stevenwu at apple.com> wrote:
> Fix an assertion failure in CheckBuiltinFunctionCall.
> memccpy_chk should have source and dest size at arg 3 and 4.
>
> ---
>  lib/Sema/SemaChecking.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
> index 7462869..5ea862c 100644
> --- a/lib/Sema/SemaChecking.cpp
> +++ b/lib/Sema/SemaChecking.cpp
> @@ -365,7 +365,6 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
>    // check secure string manipulation functions where overflows
>    // are detectable at compile time
>    case Builtin::BI__builtin___memcpy_chk:
> -  case Builtin::BI__builtin___memccpy_chk:
>    case Builtin::BI__builtin___memmove_chk:
>    case Builtin::BI__builtin___memset_chk:
>    case Builtin::BI__builtin___strlcat_chk:
> @@ -375,6 +374,9 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
>    case Builtin::BI__builtin___stpncpy_chk:
>      SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3);
>      break;
> +  case Builtin::BI__builtin___memccpy_chk:
> +    SemaBuiltinMemChkCall(*this, FDecl, TheCall, 3, 4);
> +    break;
>    case Builtin::BI__builtin___snprintf_chk:
>    case Builtin::BI__builtin___vsnprintf_chk:
>      SemaBuiltinMemChkCall(*this, FDecl, TheCall, 1, 3);
>
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list