math: enhance the endloop condition of function handle_input_flag found that the endloop condition is not correct, cause when the loop variable " i " euqal to 16, than the input_flags[16] will be out of bounds. though i think for now the inputs maybe all
diff mbox series

Message ID 20191023104737.1048-1-liqingqing3@huawei.com
State New
Headers show
Series
  • math: enhance the endloop condition of function handle_input_flag found that the endloop condition is not correct, cause when the loop variable " i " euqal to 16, than the input_flags[16] will be out of bounds. though i think for now the inputs maybe all
Related show

Commit Message

liqingqing Oct. 23, 2019, 10:47 a.m. UTC
From: l00283554 <liqingqing3@huawei.com>

---
 math/gen-auto-libm-tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Weimer Oct. 23, 2019, 11:06 a.m. UTC | #1
> From: l00283554 <liqingqing3@huawei.com>
>
> ---
>  math/gen-auto-libm-tests.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
> index f15af29..08684c4 100644
> --- a/math/gen-auto-libm-tests.c
> +++ b/math/gen-auto-libm-tests.c
> @@ -1298,7 +1298,7 @@ handle_input_flag (char *arg, input_flag *flag,
>    char c = *ep;
>    *ep = 0;
>    bool found = false;
> -  for (input_flag_type i = flag_first_flag; i <= num_input_flag_types; i++)
> +  for (input_flag_type i = flag_first_flag; i < num_input_flag_types; i++)
>      {
>        if (strcmp (arg, input_flags[i]) == 0)
>  	{

I think the change looks good.  Would you please resubmit it with a
properly formatted commit message?  Thanks.

Florian

Patch
diff mbox series

diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index f15af29..08684c4 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -1298,7 +1298,7 @@  handle_input_flag (char *arg, input_flag *flag,
   char c = *ep;
   *ep = 0;
   bool found = false;
-  for (input_flag_type i = flag_first_flag; i <= num_input_flag_types; i++)
+  for (input_flag_type i = flag_first_flag; i < num_input_flag_types; i++)
     {
       if (strcmp (arg, input_flags[i]) == 0)
 	{