|
From: Ethan M. <merritt@u.washington.edu> - 2010-03-17 03:43:23
|
On Tuesday 16 March 2010, Jürgen Wieferink wrote:
> Am Montag, 15. März 2010 15:24:39 schrieb Benjamin Lindner:
> >
> > But I managed to (hopefully) track it down to :
> > event_keypress()
> > builtin_toggle_grid()
> > do_string_replot()
> > replotrequest()
> > m_capture() <- segfault
> >
> > Here m_capture() is called with both the parameters "start" and "end" as -1
> > which (not surprisingly) leads to problems as the array token[] is indexed
> > with both start and end.
> >
> > The problem is, that at the time replotrequest() is called from within
> > do_string_replot(), c_token is -1 and num_token is zero (Why? because
> > do_string_and_free() calls lf_pop(), which sets c_token=-1 and
> > num_token=0).
> >
> > But apparently replotrequest() assumes that neither is the case, instead it
> > tries to read tokens where there are none.
>
> A remarkably good bug report. As far as I can see,
> do_string_replot() should not call a function which takes a look at
> the command line.
I think that part is OK. The idea of the "replot" command is that you can
append a string to it. do_string_replot first executes the old plot command,
then executes the extra string.
> I am surprised that this has not produced more problems so far.
Me too. But it seems to be a simple initialization failure.
When stepping through the arguments on a command line, the program
initializes c_token if the current argument is a file name but not
if the current argument is '-'. The first time we do an lf_push(),
it pushes the initial value of c_token. If that value is garbage,
then trouble ensues.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff -urp gnuplot/src/plot.c gnuplot-cvs/src/plot.c
--- gnuplot/src/plot.c 2010-03-14 11:52:45.000000000 -0700
+++ gnuplot-cvs/src/plot.c 2010-03-16 20:23:31.000000000 -0700
@@ -610,6 +610,7 @@ main(int argc, char **argv)
} else if (strcmp(*argv, "-") == 0) {
/* DBT 10-7-98 go interactive if "-" on command line */
+ c_token = 0;
interactive = TRUE;
/* will this work on all platforms? */
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Tatsuro MATSUOKA <tma...@ya...> wrote >
> I think it is a bug to be reported.
> In the release note of gnuplot-4.4.0
Wait a moment. Benjamin's original bug report said:
> I see this on windows platform using the windows terminal
> and only for the 4.5.0 branch, *not* for the 4.4.0 branch
I was able to replicate this in linux, again only in the 4.5 branch.
Are you also seeing this segfault in 4.4.0?
|