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

 
 

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

Submitted by:  None
Submitted on:  Sat 25 Jul 2015 01:52:46 PM UTC  
 
Severity: 4 - ImportantStatus: 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.

 

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

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 07 Dec 2015 03:15:48 PM UTCbensOpen/ClosedOpen=>Closed
    Sun 26 Jul 2015 08:27:17 AM UTCbensStatusIn Progress=>Fixed
      SummaryRegExp replacing empty with empty causes infinite loop=>replacing the regex anchor $ causes an infinite loop
    Sat 25 Jul 2015 04:56:45 PM UTCbensAttached 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.1-cleanup1