Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#135 Segfault when overriding stdin

segfault
closed-fixed
Sam Steingold
clisp (525)
5
2002-11-28
2002-11-26
Marc Mertens
No

Hello,

I'm using the fundamental-input-stream class to
inplement a listener, which does some processing when
there is no input on *standard-input*. Essentially I
replace the *standard-input* with my version of a input
stream. The problem is that I get a segfault when the
standard input contains just a return character. To
simulate the problem do the following after starting lisp (I
have attached the clispbug.lisp file in this message).

Start clisp and then type in the following

(load "clispbug.lisp")
(enable-listeners)

type now 10 , clisp returns 10 like it should be
type now (cos 20) and clisp returns the cosinus

however if you just type a return I get a segfault.

Can someone help me.

Thanks a lot in advance

Marc Mertens
mmertens@vt4.net

Discussion

  • Marc Mertens
    Marc Mertens
    2002-11-26

    File containing listener code

     
    Attachments
  • Marc Mertens
    Marc Mertens
    2002-11-27

    Logged In: YES
    user_id=13143

    I forget to tell the version of CLISP I'm using, its version 2.30
    in Linux, I have compiled it from source using the default
    settings

     
  • Sam Steingold
    Sam Steingold
    2002-11-27

    Logged In: YES
    user_id=5735

    please try this 1-line patch:

    --- array.d.~1.64.~ 2002-11-15 23:52:01.000000000 -0500
    +++ array.d 2002-11-27 18:48:47.000000000 -0500
    @@ -3882,6 +3882,7 @@
    can trigger GC */
    global object ssstring_append_extend (object ssstring,
    object srcstring,
    uintL start, uintL len) {
    + if (len == 0) return ssstring;
    var uintL old_len = TheIarray(ssstring)->dims[1]; /*
    length = fill-pointer */
    if (old_len + len > TheIarray(ssstring)->dims[0]) { /*
    len bytes will not fit */
    pushSTACK(srcstring);

    thanks.

     
  • Sam Steingold
    Sam Steingold
    2002-11-28

    Logged In: YES
    user_id=5735

    actually, this patch (also a one-liner) is better (either
    should fix the bug, but this one will go in).

    --- stream.d.~1.314.~ 2002-11-25 12:29:38.000000000 -0500
    +++ stream.d 2002-11-28 10:54:26.000000000 -0500
    @@ -16354,6 +16354,7 @@
    var uintL len;
    var uintL offset;
    var object srcstring =
    unpack_string_ro(value1,&len,&offset);
    + if (len > 0)
    ssstring_append_extend(*buffer_,srcstring,offset,len);
    return eofp;
    }

     
  • Sam Steingold
    Sam Steingold
    2002-11-28

    • status: open --> closed-fixed
     
  • Sam Steingold
    Sam Steingold
    2002-11-28

    Logged In: YES
    user_id=5735

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).