Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: sergiodj@redhat.com
Cc: gdb-patches@sourceware.org, brobecker@adacore.com
Subject: Re: [PATCH] Fix for PR tdep/16397: SystemTap SDT probe support for x86 doesn't work with "triplet operands"
Date: Sun, 02 Feb 2014 17:07:00 -0000	[thread overview]
Message-ID: <201402021707.s12H7Ujw029328@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <m38utt8omq.fsf@redhat.com> (message from Sergio Durigan Junior	on Sun, 02 Feb 2014 14:29:01 -0200)

> From: Sergio Durigan Junior <sergiodj@redhat.com>
> Date: Sun, 02 Feb 2014 14:29:01 -0200
> 
> On Thursday, January 30 2014, Mark Kettenis wrote:
> 
> >> From: Sergio Durigan Junior <sergiodj@redhat.com>
> >> Date: Thu, 30 Jan 2014 13:16:15 -0200
> >> 
> >> On Friday, January 17 2014, I wrote:
> >> 
> >> > On Sunday, January 12 2014, I wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> This is the continuation of what Joel proposed on:
> >> >>
> >> >> <https://sourceware.org/ml/gdb-patches/2013-12/msg00977.html>
> >> >
> >> > Ping.
> >> 
> >> Ping^2.
> >
> > No objection to this going in (other than the unsafe use of
> > isdigit(3))
> 
> Could you be more specific about the unsafe use of isdigit?

  char *s;
  ...
  if (isdigit(*s)) ...;

On most platforms chars are signed.  The argument of isdigit(3) is
(signed) int.  If *s is outside the 7-bi ASCII range, it will be
negative.  The conversion to int will not change this.  But calling
isdigit(3) with an argument that isn't in the range 0-255 and isn't
EOF (-1) is undefined.  Many C libraries will do a range check, but a
naive (but standards conforming) implementation might just look at a
negative array index and crash your program.

The correct way to use these functions in code like this is to
explicitly cast the argument to unsigned char.

Cheers,

Mark


  reply	other threads:[~2014-02-02 17:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12  4:06 Sergio Durigan Junior
2014-01-17 21:31 ` Sergio Durigan Junior
2014-01-30 15:16   ` Sergio Durigan Junior
2014-01-30 15:36     ` Mark Kettenis
2014-02-02 16:29       ` Sergio Durigan Junior
2014-02-02 17:07         ` Mark Kettenis [this message]
2014-02-20 21:53       ` Sergio Durigan Junior
2014-06-22 21:14         ` [testsuite patch+7.8] gdb.arch/amd64-stap-special-operands.exp !is_lp64_target [Re: [PATCH] Fix for PR tdep/16397: SystemTap SDT probe support for x86 doesn't work with "triplet operands"] Jan Kratochvil
2014-06-22 22:17           ` Sergio Durigan Junior
2014-06-23  6:30             ` [testsuite obv+7.8] " 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=201402021707.s12H7Ujw029328@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.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