public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Cc: Cyril Yared <yaredcyril@gmail.com>
Subject: Re: Null-pointer dereference bug in nano-malloc
Date: Tue, 25 Jan 2022 13:35:08 +0100	[thread overview]
Message-ID: <Ye/ufG4G1kqASYhd@calimero.vinschen.de> (raw)
In-Reply-To: <CAFq0=_MsCp0=AaHENtW=idrD4Z=PYX40ybJnyY85_qZ4urdN0g@mail.gmail.com>

On Jan 24 22:04, Cyril Yared wrote:
> Hi,
> It appears that commit 84d068971 introduced a null-pointer dereference in
> nano-malloc when the following two conditions are met:
> 
> 1). The free_list has no items (= NULL).
> 2). The call to sbrk_aligned returns -1 (failure).
> 
> On line 325 of newlib/libc/stdlib/nano-mallocr.c, there is a check:
> 
> if ((char *)p + p->size == (char *)_SBRK_R(RCALL 0))
> {
> 
> If the two conditions are met, then p = free_list = NULL so p->size will be
> a null-pointer dereference. Is this something that's known/being tracked
> anywhere?

I don't think so.  Just send a patch, please.


Corinna


      reply	other threads:[~2022-01-25 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  6:04 Cyril Yared
2022-01-25 12:35 ` Corinna Vinschen [this message]

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=Ye/ufG4G1kqASYhd@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=newlib@sourceware.org \
    --cc=yaredcyril@gmail.com \
    /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).