public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] math: enhance the endloop condition of function handle_input_flag
@ 2019-11-07  0:31 Joseph Myers
  0 siblings, 0 replies; only message in thread
From: Joseph Myers @ 2019-11-07  0:31 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dae7bf38978294f7d1aeece7f31c738281a3ba04

commit dae7bf38978294f7d1aeece7f31c738281a3ba04
Author: liqingqing <liqingqing3@huawei.com>
Date:   Thu Nov 7 00:26:54 2019 +0000

    math: enhance the endloop condition of function handle_input_flag
    
    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.)

Diff:
---
 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)
 	{


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-07  0:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07  0:31 [glibc] math: enhance the endloop condition of function handle_input_flag Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).