public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] testsuite/98002 - fix gcc.dg/strncmp-2.c
Date: Fri, 23 Apr 2021 10:22:50 +0000 (GMT)	[thread overview]
Message-ID: <20210423102250.D182F3A7641B@sourceware.org> (raw)

https://gcc.gnu.org/g:6724d053925c4dccc7f4dd7f4fb38f4b62020c6f

commit 6724d053925c4dccc7f4dd7f4fb38f4b62020c6f
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Nov 26 10:07:06 2020 +0100

    testsuite/98002 - fix gcc.dg/strncmp-2.c
    
    This makes sure not to free() memory we have mprotected to PROT_NONE
    by calling mprotect again with PROT_READ|PROT_WRITE.  This avoids
    crashing the allocator when in debug mode.
    
    2020-11-16  Richard Biener  <rguenther@suse.de>
    
            PR testsuite/98002
            * gcc.dg/strncmp-2.c: Call mprotect again before free.
    
    (cherry picked from commit 5b3a8fad18324cd38c221bdb0ae2b690fc82ede0)

Diff:
---
 gcc/testsuite/gcc.dg/strncmp-2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/gcc.dg/strncmp-2.c b/gcc/testsuite/gcc.dg/strncmp-2.c
index f5555ba4081..40a4f501448 100644
--- a/gcc/testsuite/gcc.dg/strncmp-2.c
+++ b/gcc/testsuite/gcc.dg/strncmp-2.c
@@ -40,6 +40,7 @@ static void test_driver_strncmp (void (test_strncmp)(const char *, const char *,
     e = lib_memcmp(buf1,p2,sz);
     (*test_memcmp)(buf1,p2,e);
   }
+  mprotect (buf2+pgsz,pgsz,PROT_READ|PROT_WRITE);
   free(buf2);
 }


                 reply	other threads:[~2021-04-23 10:22 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=20210423102250.D182F3A7641B@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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).