Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] segv fix when eof is typed in actions
@ 2004-01-02  2:12 Pawel Ostrowski
  2004-01-06  1:14 ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Pawel Ostrowski @ 2004-01-02  2:12 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] segv fix when eof is typed in actions
  2004-01-02  2:12 [PATCH] segv fix when eof is typed in actions Pawel Ostrowski
@ 2004-01-06  1:14 ` Michael Snyder
  2004-01-06 11:56   ` Paweł Ostrowski
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2004-01-06  1:14 UTC (permalink / raw)
  To: Pawel Ostrowski; +Cc: gdb-patches

Pawel Ostrowski wrote:
> 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

Approved -- want me to check it in for you?


> 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
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] segv fix when eof is typed in actions
  2004-01-06  1:14 ` Michael Snyder
@ 2004-01-06 11:56   ` Paweł Ostrowski
  2004-01-07 19:16     ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Paweł Ostrowski @ 2004-01-06 11:56 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Pawel Ostrowski, gdb-patches

Dnia Mon, Jan 05, 2004 at 05:13:58PM -0800, Michael Snyder napisaÂł(a):
> >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
> 
> Approved -- want me to check it in for you?

Yes, please. I will be obliged for helping me in this matter.

-- 
Pasza


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] segv fix when eof is typed in actions
  2004-01-06 11:56   ` Paweł Ostrowski
@ 2004-01-07 19:16     ` Michael Snyder
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2004-01-07 19:16 UTC (permalink / raw)
  To: Pawe� Ostrowski; +Cc: gdb-patches

Pawe� Ostrowski wrote:
> Dnia Mon, Jan 05, 2004 at 05:13:58PM -0800, Michael Snyder napisał(a):
> 
>>>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
>>
>>Approved -- want me to check it in for you?
> 
> 
> Yes, please. I will be obliged for helping me in this matter.

Committed.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-07 19:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-02  2:12 [PATCH] segv fix when eof is typed in actions Pawel Ostrowski
2004-01-06  1:14 ` Michael Snyder
2004-01-06 11:56   ` Paweł Ostrowski
2004-01-07 19:16     ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox