bugGNU nano - Bugs: bug #65369, nano crashes after searching in...

 
 

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

bug #65369: nano crashes after searching in help during a regex replace session

Submitter:  correctmost <correctmost>
Submitted:  Mon 26 Feb 2024 09:41:29 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Open

Mon 26 Feb 2024 12:34:40 PM UTC, comment #2: 

Fixed in git, commit ee1a1306, by returning immediately from tidy_up_after_search() when 'inhelp' is set.  (This should be fine, because the mark cannot be set in help texts either, and the syntax for help texts does not -- and should not -- use multiline regexes, so 'recook' and 'perturbed' are irrelevant too.)

Benno Schulenberg <bens>
Group administrator
Mon 26 Feb 2024 12:07:51 PM UTC, comment #1: 

Thanks for reporting.  The crash is caused by the Search-in-help freeing the compiled regex before the replacement session is going to use it.  But when searching in a help text, regex and case and backward are not used, so... when 'inhelp' is set, tidy_up_after_search() should not free anything (nor do anything else).

Benno Schulenberg <bens>
Group administrator
Mon 26 Feb 2024 09:41:29 AM UTC, original submission:  

Steps to reproduce:
01 - Run `nano --ignore`
02 - Alt + r
03 - Alt + r
04 - Type a
05 - Press enter
06 - Ctrl + g
07 - Alt + f
08 - Ctrl + g
09 - Type b
10 - Press enter


Valgrind output:

Invalid read of size 4
   at 0x4A1B3E7: regexec@@GLIBC_2.3.4 (regexec.c:214)
   by 0x1393A8: strstrwrapper (utils.c:270)
   by 0x12ED67: findnextstr (search.c:210)
   by 0x12F8C2: do_replace_loop (search.c:561)
   by 0x12FEAE: ask_for_and_do_replacements (search.c:725)
   by 0x12EABB: search_init (search.c:132)
   by 0x12FDAA: do_replace (search.c:696)
   by 0x126163: process_a_keystroke (nano.c:1685)
   by 0x127FC4: main (nano.c:2651)
 Address 0xd8 is not stack'd, malloc'd or (recently) free'd


Version: 4673e709b2b04e32db3a9c6cc561db04b0a517b1

correctmost <correctmost>

 

(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 (Posted a comment)
  • -email is unavailable- added by correctmost (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
    2024-02-26 bens StatusConfirmed Fixed
    2024-02-26 bens StatusNone Confirmed
        Assigned toNone bens
        SummaryCrash after performing regex search in help during replace session nano crashes after searching in help during a regex replace session

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code