public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org,
	Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	"Andreas K . Huettel" <dilfridge@gentoo.org>
Subject: Re: [PATCH] qsort: Fix a typo causing unnecessary malloc/free
Date: Tue, 23 Jan 2024 03:54:43 +0800	[thread overview]
Message-ID: <1dec988483b2d75185ad7849e2ad556b7a08f1ad.camel@xry111.site> (raw)
In-Reply-To: <CAMe9rOpHM_9SThtZihYbiA=wQijBxyyOzAjJjAu65tZkCnTJyA@mail.gmail.com>

On Mon, 2024-01-22 at 11:46 -0800, H.J. Lu wrote:
> On Mon, Jan 22, 2024 at 11:32 AM Xi Ruoyao <xry111@xry111.site> wrote:
> > 
> > In qsort_r we allocate a buffer sized QSORT_STACK_SIZE (1024) on stack
> > and we intend to use it if all elements can fit into it.  But there is a
> > typo:
> > 
> >      if (total_size < sizeof buf)
> >        buf = tmp;
> >      else
> >        /* allocate a buffer on heap and use it ... */
> > 
> > Here "buf" is a pointer, thus sizeof buf is just 4 or 8, instead of
> > 1024.
> 
> This sounds like a real bug.  A glibc bug report is needed to track it.

https://sourceware.org/bugzilla/show_bug.cgi?id=31276

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2024-01-22 19:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 19:30 Xi Ruoyao
2024-01-22 19:46 ` H.J. Lu
2024-01-22 19:54   ` Xi Ruoyao [this message]
2024-01-22 19:57     ` Xi Ruoyao
2024-01-22 20:29       ` [PATCH v2] qsort: Fix a typo causing unnecessary malloc/free (BZ 31276) Xi Ruoyao
2024-01-22 20:31         ` Adhemerval Zanella Netto
2024-01-22 20:50           ` Andreas K. Huettel
2024-01-23  8:20             ` Xi Ruoyao
2024-01-23 13:18               ` H.J. Lu
2024-01-24 13:45 ` [PATCH] qsort: Fix a typo causing unnecessary malloc/free Florian Weimer
2024-01-24 13:49   ` Xi Ruoyao

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=1dec988483b2d75185ad7849e2ad556b7a08f1ad.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=adhemerval.zanella@linaro.org \
    --cc=dilfridge@gentoo.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@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).