From patchwork Mon Oct 28 08:01:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Qingqing Li X-Patchwork-Id: 35394 Received: (qmail 108227 invoked by alias); 28 Oct 2019 08:03:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 108128 invoked by uid 89); 28 Oct 2019 08:03:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=H*RU:!127.0.0.1!, HX-Spam-Relays-External:!127.0.0.1!, enhance, HX-Languages-Length:992 X-HELO: huawei.com To: , , From: liqingqing Subject: [PATCH] math: enhance the endloop condition of function handle_input_flag Message-ID: <3f569a2a-b8a9-471e-96ed-a94ded8c044b@huawei.com> Date: Mon, 28 Oct 2019 16:01:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 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)      {