bugGNU nano - Bugs: bug #62899, there will be a problem when...

 
 

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

bug #62899: there will be a problem when binding to a sequence of functions is merged

Submitter:  Benno Schulenberg <bens>
Submitted:  Sun 14 Aug 2022 02:37:07 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 16 Aug 2022 01:16:06 PM UTC, comment #2: 

The extra variable has been introduced in commit 10b4d0c8, and the okay_for_view() function was reworked in commit 4b928b46.  So, there should now be no more dereferences of 'shortcut' after its corresponding function has been executed.

Benno Schulenberg <bens>
Group administrator
Sun 14 Aug 2022 02:41:30 PM UTC, comment #1: 

With the given line in your .nanorc file and running 'src/nano README' and typing ^D, the result in valgrind is this:

==10982== Invalid read of size 8
==10982==    at 0x121945: okay_for_view (nano.c:1380)
==10982==    by 0x121945: process_a_keystroke (nano.c:1660)
==10982==    by 0x10E425: main (nano.c:2588)
==10982==  Address 0x5bc7ca0 is 16 bytes inside a block of size 48 free'd
==10982==    at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10982==    by 0x1372B7: rpl_free (free.c:44)
==10982==    by 0x1301D7: get_code_from_plantation (winio.c:360)
==10982==    by 0x135837: parse_kbinput (winio.c:986)
==10982==    by 0x136277: get_kbinput (winio.c:1339)
==10982==    by 0x12234C: do_statusbar_input (prompt.c:269)
==10982==    by 0x122B95: acquire_an_answer (prompt.c:483)
==10982==    by 0x122FB6: do_prompt (prompt.c:623)
==10982==    by 0x1163EC: insert_a_file_or (files.c:1199)
==10982==    by 0x121903: process_a_keystroke (nano.c:1642)
==10982==    by 0x10E425: main (nano.c:2588)
==10982==  Block was alloc'd at
==10982==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10982==    by 0x12F8C8: nmalloc (utils.c:288)
==10982==    by 0x1239C2: strtosc (rcfile.c:226)
==10982==    by 0x130200: get_code_from_plantation (winio.c:363)
==10982==    by 0x135837: parse_kbinput (winio.c:986)
==10982==    by 0x136277: get_kbinput (winio.c:1339)
==10982==    by 0x1217B5: process_a_keystroke (nano.c:1533)
==10982==    by 0x10E425: main (nano.c:2588)

Benno Schulenberg <bens>
Group administrator
Sun 14 Aug 2022 02:37:07 PM UTC, original submission:  

When using the patch as posted in bug #61692, and having the following line in your .nanorc:

bind ^D "{execute}{cancel}" main

The main key-processing routine will try to access the shortcut structure for 'execute' after it has been run and then freed by the interpretation of the 'cancel' command.

Fixing this will require another variable, 'function', to remember what the shortcut's func was, so the shortcut structure does not need to be accessed again, AND it would need to store the result of okay_for_view(), so this function does not need to be called after the shortcut's function has been run.

But I don't like that latter thing -- calling okay_for_view() when it's not absolutely necessary is a waste of time.  And if it has to be called, it would be much better if it were like the wanted_to_move() function: just check for a bunch of functions that are NOT okay in view mode, and drop the last parameter of add_to_funcs().

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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-16 bens StatusNone Fixed
        Open/ClosedOpen Closed
    2022-08-14 bens Summarythere will be problem when binding to a sequence of functions is merged there will be a problem when binding to a sequence of functions is merged

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code