This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2] math: enhance the endloop condition of function handle_input_flag


From: l00283554 <liqingqing3@huawei.com>

v2:
 - sorry, update the topic, pls ingore the first email.

review the source code of function "handle_input_flag"
and found that the endloop condition is not correct, cause when the loop variable
 " i " euqal to 16, then the input_flags[16] will be out of bounds. though I 
 think for now the inputs maybe all right, but just enhanced it.

---
 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 f15af29a4e0..08684c4646d 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)
 	{
-- 
2.23.0.windows.1



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]