Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pawel Ostrowski <pasza@zodiac.mimuw.edu.pl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] segv fix when eof is typed in actions
Date: Fri, 02 Jan 2004 02:12:00 -0000	[thread overview]
Message-ID: <20040102021243.GA28939@dixie.localdomain> (raw)

Hello,

GDB (snapshot 20031230) segfaults on the following script (and on any
program being debugged: int main() {return 0;} is enough):

trace main
actions 1
<EOF here>

I have found out that typing EOF when editing tracepoint actions
causes gdb to segv. The segv is caused by dereferencing twice line
parameter (**line), when *line is NULL. I have added check for this
case to validate_actionline() in tracepoint.c, so it now ends actions
editing (just like you would have typed "end" instead of EOF).

Some details of my configuration:
- gdb versions: 6.0, 20031230 snapshot, both compiled with gcc 3.3.2
- uname -rmpo: 2.6.0 i686 AMD_Athlon(tm)_XP_1500+ PLD Linux


Changelog:
2004-01-02  Pawel Ostrowski  <pasza@zodiac.mimuw.edu.pl>

        * tracepoint.c (validate_actionline): Fix segv at EOF
        

And the patch:

*** gdb-6.0-orig/gdb/tracepoint.c	Thu Jun 12 01:29:48 2003
--- gdb-6.0/gdb/tracepoint.c	Fri Jan  2 02:11:58 2004
*************** validate_actionline (char **line, struct
*** 914,919 ****
--- 914,923 ----
    struct cleanup *old_chain = NULL;
    char *p;

+   /* if EOF is typed, *line is NULL */
+   if (*line == NULL)
+     return END;
+
    for (p = *line; isspace ((int) *p);)
      p++;


--
Pasza


             reply	other threads:[~2004-01-02  2:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02  2:12 Pawel Ostrowski [this message]
2004-01-06  1:14 ` Michael Snyder
2004-01-06 11:56   ` Paweł Ostrowski
2004-01-07 19:16     ` Michael Snyder

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=20040102021243.GA28939@dixie.localdomain \
    --to=pasza@zodiac.mimuw.edu.pl \
    --cc=gdb-patches@sources.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