bugGNU nano - Bugs: bug #48103, after saving a file under a...

 
 

bug #48103: after saving a file under a different name, nano aborts

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Thu 02 Jun 2016 07:50:24 PM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 08 Jun 2016 06:35:42 PM UTC, comment #2:

Fixed in git by ca2c808, and less watefully (not doing a recalculation of the multidata whenever a file is saved) by 5aa1df3.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 08 Jun 2016 10:33:49 AM UTC, comment #1:

When the filename changes, it starts to use a different syntax. If this syntax has more multis than the previous one, it will start accessing data outside of the reserved records.

So, whenever the filename changes, all multidata should be freed. After which precalc() will reallocate the needed amounts.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
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)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 Jun 2016 10:14:24 AM UTCbensOpen/ClosedOpen=>Closed
    Wed 08 Jun 2016 06:35:42 PM UTCbensStatusIn Progress=>Fixed
    Wed 08 Jun 2016 10:33:49 AM UTCbensStatusNone=>In Progress

    Back to the top


    Powered by Savane 3.1-cleanup1