bugGNU nano - Bugs: bug #60596, memory leak for automatic...

 
 

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

bug #60596: memory leak for automatic hardwrapping of quoted text

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Thu 13 May 2021 07:44:31 AM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Closed

Fri 14 May 2021 08:04:12 AM UTC, comment #2: 

Fixed in git, commit f23e98dd, by freeing the existing 'strdata' before calling update_undo(ENTER) the second time.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 13 May 2021 03:03:11 PM UTC, comment #1: 

The leakage is caused when do_wrap() calls update_undo(ENTER) -- the earlier do_enter() has already made this call, meaning that this new call will leak the existing u->strdata.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 13 May 2021 07:44:31 AM UTC, original submission:  

To reproduce, compile nano with -fsanitize=address, and run:

echo "#what word word"  >oneline
src/nano --ignore --break --fill=20  oneline

Then type: <Tab>
See that the one line gets hardwrapped into two, with the second also starting with a #.
Now exit: ^X ^Q
Result:

==7379==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x7fcce9152b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x5566a2165efa in nmalloc /home/ben/Sources/NANO/src/utils.c:289
    #2 0x5566a2166019 in measured_copy /home/ben/Sources/NANO/src/utils.c:331
    #3 0x5566a21660a7 in copy_of /home/ben/Sources/NANO/src/utils.c:342
    #4 0x5566a2156b9a in update_undo /home/ben/Sources/NANO/src/text.c:1137
    #5 0x5566a215486e in do_enter /home/ben/Sources/NANO/src/text.c:907
    #6 0x5566a2158190 in do_wrap /home/ben/Sources/NANO/src/text.c:1322
    #7 0x5566a2131768 in inject /home/ben/Sources/NANO/src/nano.c:1469
    #8 0x5566a214de68 in do_tab /home/ben/Sources/NANO/src/text.c:85
    #9 0x5566a2132932 in process_a_keystroke /home/ben/Sources/NANO/src/nano.c:1621
    #10 0x5566a21384c3 in main /home/ben/Sources/NANO/src/nano.c:2537
    #11 0x7fcce884bbf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)

SUMMARY: AddressSanitizer: 5 byte(s) leaked in 1 allocation(s).

(Problem was found by repeating the recipe in bug #57422.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-16 bens Open/ClosedOpen => Closed
    2021-05-15 bens Summarymemory leak when automatic hardwrapping of quoted text occurs => memory leak for automatic hardwrapping of quoted text
    2021-05-14 bens StatusNone => Fixed

    Back to the top


    Powered by Savane 3.7