bugGNU nano - Bugs: bug #27265, nano crashes when the terminal is...

 
 

bug #27265: nano crashes when the terminal is too narrow

Submitted by:  Brian Bi <bbi5291>
Submitted on:  Sun 16 Aug 2009 11:27:15 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 09 Apr 2014 05:57:58 PM UTC, comment #2:

In current SVN, the number of help items gets smaller as the window gets narrower, so the (COLS / something) would become zero (and cause a division by zero later on) only when the window gets narrower than four columns. But when that happens, nano dies in a controlled way (in nano.c: die(_("Window size is too small for nano...\n"));) and saves all open buffers in *.save files. So I consider this fixed. If you still find a crash, please reopen.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 19 Jan 2010 10:15:34 PM UTC, comment #1:

Diff attached base on current trunk (2.2.2-svn), that contains a fix.

First timer here (professional C developer for 15+ yrs), but new to gnu - apologies if I'm not following procedure here!

My fix is simple, and stops the crash, but I do feel that more could be done (?)

(file #19518)

Nigel Derbyshire <nad6234>
Sun 16 Aug 2009 11:27:15 PM UTC, original submission:

At winio.c:2424 in release 2.0.9 and winio.c:2390 in the new 2.1.0 release is the line:
onekey(keystr, s->desc, colwidth + (COLS % colwidth));
colwidth is calculated as follows:
colwidth = COLS / ((slen / 2) + (slen % 2));
Evidently, there is a possibility for division by zero here. In the default configuration, slen = 12, so SIGFPE occurs when the terminal is fewer than 6 characters wide. This is of course quite an unreasonable width; I can't think of when it would be useful for me to resize a window to this width. Still, I suppose in the case that I somehow did this by accident, not only would nano crash, but the buffer would be lost, as it is written to disk only if nano terminates due to SIGHUP or SIGTERM, and not the unforeseen SIGFPE.

Brian Bi <bbi5291>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #19518:  winio.c27265.diff added by nad6234 (713B - text/x-patch - change attached - any comments welcome!)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)
  • -unavailable- added by nad6234 (Updated the item)
  • -unavailable- added by bbi5291 (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 09 Apr 2014 05:57:58 PM UTCbensStatusNone=>Fixed
      Assigned toNone=>bens
      Open/ClosedOpen=>Closed
    Tue 19 Jan 2010 10:15:34 PM UTCnad6234Attached File-=>Added winio.c27265.diff, #19518

    Back to the top


    Powered by Savane 3.1-cleanup1