From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23062 invoked by alias); 2 Feb 2014 17:07:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23051 invoked by uid 89); 2 Feb 2014 17:07:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: glazunov.sibelius.xs4all.nl Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 02 Feb 2014 17:07:41 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id s12H7V2J020444; Sun, 2 Feb 2014 18:07:31 +0100 (CET) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id s12H7Ujw029328; Sun, 2 Feb 2014 18:07:30 +0100 (CET) Date: Sun, 02 Feb 2014 17:07:00 -0000 Message-Id: <201402021707.s12H7Ujw029328@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: sergiodj@redhat.com CC: gdb-patches@sourceware.org, brobecker@adacore.com In-reply-to: (message from Sergio Durigan Junior on Sun, 02 Feb 2014 14:29:01 -0200) Subject: Re: [PATCH] Fix for PR tdep/16397: SystemTap SDT probe support for x86 doesn't work with "triplet operands" References: <201401301535.s0UFZp3N013895@glazunov.sibelius.xs4all.nl> X-SW-Source: 2014-02/txt/msg00004.txt.bz2 > From: Sergio Durigan Junior > Date: Sun, 02 Feb 2014 14:29:01 -0200 > > On Thursday, January 30 2014, Mark Kettenis wrote: > > >> From: Sergio Durigan Junior > >> 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: > >> >> > >> >> > >> > > >> > 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