bugGNU nano - Bugs: bug #45626, replacing the regex anchor $...

 
 

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

bug #45626: replacing the regex anchor $ causes an infinite loop

Submitter:  None
Submitted:  Sat 25 Jul 2015 01:52:46 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Sun 26 Jul 2015 08:27:17 AM UTC, comment #2: 

Also a useful replacement can cause an infinite loop:
'nano README', M-R M-R $ <Enter> oops <Enter>,
and then keep typing Y.

Fixed in SVN, r5319.  Thanks again for reporting.

(A related problem has been reported in bug #45630.)

Benno Schulenberg <bens>
Group administrator
Sat 25 Jul 2015 04:56:45 PM UTC, comment #1: 

Thanks for reporting.  Strangely, it doesn't happen when doing the replacing in the Backwards direction -- apparently there the zero-length case is taken into account.

If you can, please try the attached patch.  It makes the forward replacing behave the same as the backwards one -- especially visible when the replacment of the anchor is not empty but some character, say x.

(file #34524)

Benno Schulenberg <bens>
Group administrator
Sat 25 Jul 2015 01:52:46 PM UTC, original submission:  

Replacing empty space (for example '^' or '$') causes nano to go into an infinite loop consuming as much CPU and memory as possible, until it is killed by the OOM killer. Presumably it repeatedly replaces the empty space.

Anonymous

 

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

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Updated 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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-07 bens Open/ClosedOpen Closed
    2015-07-26 bens StatusIn Progress Fixed
        SummaryRegExp replacing empty with empty causes infinite loop replacing the regex anchor $ causes an infinite loop
    2015-07-25 bens Attached File- Added skip-zero-length-match.patch, #34524
        Severity3 - Normal 4 - Important
        StatusNone In Progress
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code