]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math: enhance the endloop condition of function handle_input_flag
authorliqingqing <liqingqing3@huawei.com>
Thu, 7 Nov 2019 00:26:54 +0000 (00:26 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 7 Nov 2019 00:26:54 +0000 (00:26 +0000)
In the function handle_input_flag, the end-loop condition is not
correct, because when the loop variable i equals 16
(num_input_flag_types), then input_flags[16] will be out of bounds.
(This issue is only relevant with invalid input files to
gen-auto-libm-tests.)

math/gen-auto-libm-tests.c

index f15af29a4e0c80376244af0d7ed7c6c77bc6ff14..08684c4646dcdf46ded59216181ba04a5c19b223 100644 (file)
@@ -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)
        {