bugGNU nano - Bugs: bug #58879, invoking the formatter can crash...

 
 

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

bug #58879: invoking the formatter can crash when text is marked

Submitter:  Benno Schulenberg <bens>
Submitted:  Sun 02 Aug 2020 03:03:50 PM UTC
   
 
Severity:  5 - Blocker Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Sun 02 Aug 2020 05:35:40 PM UTC, comment #4: 

Fixed in git, commit 6fa81ca5, by forcing the mark off in do_formatter() before doing anything with the buffer.

Benno Schulenberg <bens>
Group administrator
Sun 02 Aug 2020 05:25:45 PM UTC, comment #3: 

The crash occurs only when the mark is at the very start of the buffer, because then the do_snip() in replace_buffer() cuts from the top of the buffer to the top of the buffer, which results in a cutbuffer of NULL, which causes a NULL dereference in update_undo().

However, when the mark is NOT at the start of the buffer, everything after the mark remains in the buffer, causing it be duplicated because the formatted text gets inserted before it.  In fact, this is even a worse bug than the crash, because it is a non-obvious corruption.

Benno Schulenberg <bens>
Group administrator
Sun 02 Aug 2020 03:19:20 PM UTC, comment #2: 

Bug exists since version 4.9.  The offending commit is 19517fc5: "elide a parameter, and rename a variable".

Benno Schulenberg <bens>
Group administrator
Sun 02 Aug 2020 03:05:53 PM UTC, comment #1: 

Sorry -- before typing M-F, one has to select some text first, for example with a single <Ctrl+Shift+Down>.

Benno Schulenberg <bens>
Group administrator
Sun 02 Aug 2020 03:03:50 PM UTC, original submission:  

To reproduce, make sure that syntax/html.nanorc is included in your nanorc.  Then run:

src/nano +1 doc/faq.html

Then invoke the formatter: M-F
Result: nano crashes.

Benno Schulenberg <bens>
Group administrator

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (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
    2020-08-13 bens Open/ClosedOpen Closed
    2020-08-02 bens Summaryinvoking the formatter causes a crash when text is marked invoking the formatter can crash when text is marked
    2020-08-02 bens StatusIn Progress Fixed
    2020-08-02 bens StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code