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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  Brian Bi <bbi5291>
Submitted:  Sun 16 Aug 2009 11:27:15 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

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>
Group administrator
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.)

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
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by nad6234 (Updated the item)
  • -email is unavailable- added by bbi5291 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-09 bens StatusNone Fixed
        Assigned toNone bens
        Open/ClosedOpen Closed
    2010-01-19 nad6234 Attached File- Added winio.c27265.diff, #19518

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code