Thu 02 Jun 2016 07:50:24 PM UTC, original submission:
When having multiple files open and having MALLOC_CHECK_ set, and saving one of those files under a different name, and then closing that buffer, nano aborts.
To reproduce, add the following four lines at the end of your .nanorc:
syntax "letters" "text.xxx" "README"
color blue start="a" end="b"
color red start="c" end="d"
color yellow start="e" end="f"
Then run 'MALLOC_CHECK_=2 src/nano src/text.c README' and type:
^O <Backspace> xxx <Enter> Y ^X
Aborted. (Printed after the message on the statusbar.)
Valgrind says thirteen times this:
==2523== Invalid read of size 2
==2523== at 0x80623DB: edit_draw (winio.c:2383)
==2523== by 0x8062FAF: update_line (winio.c:2715)
==2523== by 0x8063155: edit_refresh (winio.c:2971)
==2523== by 0x804FBFB: write_file (files.c:2158)
==2523== by 0x8050FF0: do_writeout (files.c:2475)
==2523== by 0x8051028: do_writeout_void (files.c:2490)
==2523== by 0x8057D96: do_input (nano.c:1716)
==2523== by 0x80588E8: main (nano.c:2678)
==2523== Address 0x496f5b2 is 0 bytes after a block of size 2 alloc'd
==2523== at 0x4024F20: malloc (vg_replace_malloc.c:236)
==2523== by 0x80615FB: nmalloc (utils.c:389)
==2523== by 0x804CB41: alloc_multidata_if_needed (color.c:385)
==2523== by 0x804CBCE: precalc_multicolorinfo (color.c:440)
==2523== by 0x805042C: display_buffer (files.c:554)
==2523== by 0x8058882: main (nano.c:2656)
And six times this:
==2523== Invalid write of size 2
==2523== at 0x804CD5E: reset_multis_for_id (color.c:306)
==2523== by 0x804CED7: reset_multis (color.c:375)
==2523== by 0x8057DB3: do_input (nano.c:1719)
==2523== by 0x80588E8: main (nano.c:2678)
==2523== Address 0x496f852 is 0 bytes after a block of size 2 alloc'd
==2523== at 0x4024F20: malloc (vg_replace_malloc.c:236)
==2523== by 0x80615FB: nmalloc (utils.c:389)
==2523== by 0x804CB41: alloc_multidata_if_needed (color.c:385)
==2523== by 0x804CBCE: precalc_multicolorinfo (color.c:440)
==2523== by 0x805042C: display_buffer (files.c:554)
==2523== by 0x8058882: main (nano.c:2656)
|