public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Stefan Liebler <stli@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] Fix stringop-overflow warning in test-strncat.
Date: Thu,  2 Mar 2023 13:26:18 +0000 (GMT)	[thread overview]
Message-ID: <20230302132618.8024F3858D33@sourceware.org> (raw)

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

commit 51aeab9a363a0d000d0912aa3d6490463a26fba2
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Tue Feb 28 13:48:34 2023 +0100

    Fix stringop-overflow warning in test-strncat.
    
    Starting with commit
    b2c474f8de4c92bfe7435853a96805ec32d68dfa
    "x86: Fix strncat-avx2.S reading past length [BZ #30065]"
    
    Building on s390 the test fails due warnings like:
    
    In function ‘do_one_test’,
        inlined from ‘do_overflow_tests’ at test-strncat.c:175:7:
    test-strncat.c:31:18: error: ‘strnlen’ specified bound [4294966546, 4294967295] exceeds maximum object size 2147483647 [-Werror=stringop-overflow=]
       31 | # define STRNLEN strnlen
          |                  ^
    test-strncat.c:83:16: note: in expansion of macro ‘STRNLEN’
       83 |   size_t len = STRNLEN (src, n);
    |                ^~~~~~~
    
    In all werror cases, the call to strnlen (.., SIZE_MAX) is inlined.
    Therefore this patch just marks the do_one_test function as noinline.
    
    Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Diff:
---
 string/test-strncat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/string/test-strncat.c b/string/test-strncat.c
index c0cde206ee..e71724df5b 100644
--- a/string/test-strncat.c
+++ b/string/test-strncat.c
@@ -69,6 +69,7 @@ SIMPLE_STRNCAT (CHAR *dst, const CHAR *src, size_t n)
 }
 
 static void
+__attribute__((noinline))
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
 {
   size_t k = STRLEN (dst);

                 reply	other threads:[~2023-03-02 13:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230302132618.8024F3858D33@sourceware.org \
    --to=stli@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).