hanslub42 / rlwrap

A readline wrapper
GNU General Public License v2.0
2.53k stars 149 forks source link

rlwrap segfaults on test program #167

Closed hanslub42 closed 1 year ago

hanslub42 commented 1 year ago

The small test program from #166 makes rlwrap segfault after receiving an EOF (when I press CTRL+D on an empty line)

Without rlwrap it prints an endless stream of "> \n" after an EOF.

rlwrap yes "> " does not segfault, so the fact that the test program asks for input is relevant.

Debugging with rlwrap -d8 will print:

  free() called twice, at string_utils.c:854: (on memory already freed at string_utils.c:818)

which gives a pretty good idea about what is happening. git blame shows that this is a regression introduced with 46aaddab7ac6355ad7a8ff1a698e9f23d3dfb02d, so it should be in all rlwrap versions from 0.44 onwards.

hanslub42 commented 1 year ago

fixed by b214aec35e2391c5017c15e0ad70ba1e1d1b2860

Note that it is not only the test program that would crash rlwrap. I would get occasional crashes myself, but this was the first reliably reproducible case.