Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: joost@cnoc.nl
Cc: gdb@sourceware.org
Subject: Re: Crash of Archer's gdb on mingw (passing null argument to vasprintf)
Date: Mon, 03 Oct 2011 10:07:00 -0000	[thread overview]
Message-ID: <201110031007.p93A70B8019170@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <1317634777.28003.15.camel@feddie.cnoc.lan> (message from Joost	van der Sluis on Mon, 03 Oct 2011 11:39:37 +0200)

> From: Joost van der Sluis <joost@cnoc.nl>
> Date: Mon, 03 Oct 2011 11:39:37 +0200
> 
> Hi all,
> 
> Maybe a strange question because it's not about stock gdb but about the
> fedora16-branch from the Archer project. But I know that there are not
> that much mingw/Windows people on the Archer mailinglist, so I ask here.
> 
> In gdbtypes.c there's this code:
> 
>     warning (_("Range for type %s has invalid bounds %s..%s"),
>             TYPE_NAME (type), plongest (TYPE_LOW_BOUND (range_type)),
>             plongest (TYPE_HIGH_BOUND (range_type)));
> 
> This goes wrong when TYPE_NAME (type) is null. Eventually warning()
> leads to a call of vasprintf(), and on Fedora it prints '(NULL)' when it
> encounters a null-parameter. But on mingw it crashes (sigint).
> 
> How to fix this properly? I could add a check for the assignment of
> TYPE_NAME (type). Or should mingw fix their vasprintf implementation? Or
> can I switch to another version of casprintf? (I use the
> mingw-installation from Fedora to cross-compile to mingw)

The C standard doesn't say that printf("%s", NULL) should be treated
specially, so having things crash just as the would for printf("%s",
p) where p is an invalid pointer is perfectly fine.  So blindly
printing TYPE_NAME (type) clearly is the problem here.


  reply	other threads:[~2011-10-03 10:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03  9:39 Joost van der Sluis
2011-10-03 10:07 ` Mark Kettenis [this message]
2011-10-03 14:59 ` Joel Brobecker
2011-10-03 16:17   ` Joost van der Sluis
2011-10-03 16:25     ` Joel Brobecker
2011-10-12  7:30       ` Joost van der Sluis
2011-10-03 16:35     ` Jan Kratochvil

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=201110031007.p93A70B8019170@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb@sourceware.org \
    --cc=joost@cnoc.nl \
    /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