public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com, newlib@sourceware.org
Subject: Re: crash in newlocale()
Date: Fri, 12 Aug 2022 12:50:02 +0200	[thread overview]
Message-ID: <YvYwWiI5qTPer/eE@calimero.vinschen.de> (raw)
In-Reply-To: <20220812083855.55b416d464ec153ea3280f4c@nifty.ne.jp>

On Aug 12 08:38, Takashi Yano wrote:
> On Thu, 11 Aug 2022 19:35:39 +0200
> Corinna Vinschen wrote:
> > On Aug 11 21:18, Takashi Yano wrote:
> > > On Thu, 11 Aug 2022 11:29:28 +1000
> > > Tony Cook wrote:
> > > > Hello everyone,
> > > > 
> > > > While tracking down a crash in development versions of perl the boostrap
> > > > miniperl executable was crashing early in the build process:
> > > > [...]
> > > 
> > > I looked into this problem and found the access violation
> > > occurs at:
> > > newlib/libc/locale/newlocale.c
> > > @@ 188,7 @@ _newlocale_r (struct _reent *p, int category_mask, const char *locale,
> > > 	if (tmp_locale.lc_cat[i].buf == (const void *) -1)
> > > 	  {
> > > 	    tmp_locale.lc_cat[i].buf = base->lc_cat[i].buf;
> > > 	    base->lc_cat[i].ptr = base->lc_cat[i].buf = NULL; <-- Here!!!
> > > 	  }
> > > #endif /* __HAVE_LOCALE_INFO__ */
> > >       _freelocale_r (p, base);
> > > 
> > > This is because
> > > locale_t st = newlocale(LC_ALL_MASK, "C", (locale_t)0);
> > > returns
> > >   extern const struct __locale_t __C_locale;
> > >   return (struct __locale_t *) &__C_locale;
> > > , which is in the const area that cannot be modified.
> > > [...]
> > I think the right thing to do is to avoid freeing this data, if the base
> > locale is the C locale.  I sent a patch to cygwin-patches for review.
> > Can you please take a look?
> 
> LGTM. Thanks!

Thanks for checking!  I pushed the patch with addition release msg
to the 3.3 branch as well.


Corinna

  reply	other threads:[~2022-08-12 10:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  1:29 Tony Cook
2022-08-11 12:18 ` Takashi Yano
2022-08-11 17:35   ` Corinna Vinschen
2022-08-11 23:38     ` Takashi Yano
2022-08-12 10:50       ` Corinna Vinschen [this message]
2022-08-11 13:13 ` Ken Brown
2022-08-12  0:11   ` Tony Cook
2022-08-12  1:12     ` Ken Brown

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=YvYwWiI5qTPer/eE@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=newlib@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).