bugGNU nano - Bugs: bug #62760, crash when trying to go above the...

 
 

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

bug #62760: crash when trying to go above the root directory

Submitter:  Frank Wolff <frank38>
Submitted:  Wed 13 Jul 2022 09:38:37 AM UTC
 
Severity:  5 - Blocker Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Discussion locked!

( Jump to the original submission )

Wed 03 Aug 2022 06:00:55 AM UTC, comment #12: 

The fix was released in nano-6.4.

Benno Schulenberg <bens>
Project Administrator
Sun 31 Jul 2022 07:07:37 AM UTC, comment #11: 

Please do not post on issues that have been fixed -- your report has nothing to do with the original one.  Please file a new issue, and include a clear reproduction recipe, and provide context information: what directory are you in, does it exist, what is in your nanorcs, ...?

When compiled with the options that you give, and just starting nano, nano-6.3 does not crash here.  What are you doing to make it crash?  And how did you determine that it was commit 940b5ea that broke things?  Because I don't see how that change could ever crash nano.

Benno Schulenberg <bens>
Project Administrator
Fri 29 Jul 2022 08:59:10 PM UTC, comment #10: 

Hi, the exact same problem is happening on the latest upstream:

# nano
Sorry! Nano crashed!  Code: 11.  Please report a bug.
# nano -V
GNU nano, version 6.3
(C) 1999-2011, 2013-2022 Free Software Foundation, Inc.
(C) 2014-2022 the contributors to nano
Compiled options: --disable-color --disable-extra --disable-libmagic --disable-speller --disable-tabcomp --disable-nls --enable-utf8

Here's where the problem es started:

commit 940b5eaad116232c20de7405bbb7ba4a2eb8e779 (patch)

nanobgr <nanobgr>
Wed 13 Jul 2022 05:33:56 PM UTC, comment #9: 

You're welcome.  :)

Fixed in git, commit 34238dc1, by preventing the root directory from getting identified with a double slash.

Benno Schulenberg <bens>
Project Administrator
Wed 13 Jul 2022 02:34:56 PM UTC, comment #8: 

comment #7:

> Thanks for testing.  If you wish to be credited in a Reported-by tag, please provide your full name.


Sure, my full name is Frank Wolff.

Thanks again Benno for the quick fix.

Frank Wolff <frank38>
Wed 13 Jul 2022 02:27:07 PM UTC, comment #7: 

Thanks for testing.  If you wish to be credited in a Reported-by tag, please provide your full name.

Benno Schulenberg <bens>
Project Administrator
Wed 13 Jul 2022 12:12:21 PM UTC, comment #6: 

comment #5:

> Attached patch fixes the issue for me: when at the root directory, no trailing slash should be added.  If you can verify...
>
> (file #53433)


I've applied your patch on sources from commit 18a40caa. I can confirm that it works. I've tested different cases and I can't make it crash anymore.

Frank Wolff <frank38>
Wed 13 Jul 2022 11:55:48 AM UTC, comment #5: 

Attached patch fixes the issue for me: when at the root directory, no trailing slash should be added.  If you can verify...

(file #53433)

Benno Schulenberg <bens>
Project Administrator
Wed 13 Jul 2022 11:31:06 AM UTC, comment #4: 

comment #3:

> Pressing <Down> will read/display the list, and then nano won't crash.


You're right but ".. (parent dir)" is still shown and selecting it crashes nano (I guess because of the double '/' ?).

Frank Wolff <frank38>
Wed 13 Jul 2022 11:23:49 AM UTC, comment #3: 

For some reason, when reaching the root directory, it becomes "//" instead of "/", and somehow that prevents the file list from getting read, or at least from getting displayed.  Pressing <Down> will read/display the list, and then nano won't crash.

Crash result from valgrind:

==24903== Invalid read of size 8
==24903==    at 0x10E8DE: browse (browser.c:633)
==24903==    by 0x10EBA0: browse_in (browser.c:733)
==24903==    by 0x114B09: insert_a_file_or (files.c:1249)
==24903==    by 0x114CA3: do_insertfile (files.c:1343)
==24903==    by 0x11FB67: process_a_keystroke (nano.c:1635)
==24903==    by 0x121311: main (nano.c:2580)
==24903==  Address 0x59d0d08 is 8 bytes before a block of size 272 alloc'd
==24903==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24903==    by 0x12E86C: nmalloc (utils.c:288)
==24903==    by 0x10D9D9: read_the_list (browser.c:82)
==24903==    by 0x10E1C2: browse (browser.c:443)
==24903==    by 0x10EBA0: browse_in (browser.c:733)
==24903==    by 0x114B09: insert_a_file_or (files.c:1249)
==24903==    by 0x114CA3: do_insertfile (files.c:1343)
==24903==    by 0x11FB67: process_a_keystroke (nano.c:1635)
==24903==    by 0x121311: main (nano.c:2580)
==24903==
==24903== Invalid read of size 1
==24903==    at 0x10E8F1: browse (browser.c:633)
==24903==    by 0x10EBA0: browse_in (browser.c:733)
==24903==    by 0x114B09: insert_a_file_or (files.c:1249)
==24903==    by 0x114CA3: do_insertfile (files.c:1343)
==24903==    by 0x11FB67: process_a_keystroke (nano.c:1635)
==24903==    by 0x121311: main (nano.c:2580)
==24903==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

Benno Schulenberg <bens>
Project Administrator
Wed 13 Jul 2022 10:53:33 AM UTC, comment #2: 

Bug exists since version 6.3.  Things work fine in 6.2 and before -- nano warned "[ Can't move up a directory ]" when trying to go up from the root directory.

The offending commit is fdd946c02c: "do not change to a higher directory when the working one is gone".  But why this broke things...

Benno Schulenberg <bens>
Project Administrator
Wed 13 Jul 2022 10:28:57 AM UTC, comment #1: 

Thanks for reporting.  Can confirm.  Will investigate.

Benno Schulenberg <bens>
Project Administrator
Wed 13 Jul 2022 09:38:37 AM UTC, original submission:  

Bug seen on nano v.6.3 installed on Debian sid.

Steps to reproduce the bug:

$ nano somefile.txt

[CTRL][R] + [CTRL][T] to read a new file
Select ".. (parent dir)" and go up to the root directory
Try and select ".. (parent dir)"

"Sorry! Nano crashed!  Code: 11.  Please report a bug."

Other information:

$ nano --version
 GNU nano, version 6.3
 (C) 1999-2011, 2013-2022 Free Software Foundation, Inc.
 (C) 2014-2022 the contributors to nano
 Compiled options: --disable-libmagic --enable-utf8

$ Linux XXX 5.18.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1 (2022-06-16) x86_64 GNU/Linux

Frank Wolff <frank38>

 

(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 nanobgr (Posted a comment)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by frank38 (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-03 bens Open/ClosedOpen Closed
    2022-07-31 bens Discussion LockUnlocked Locked
    2022-07-13 bens StatusNeed Info Fixed
    2022-07-13 bens StatusReady For Test Need Info
    2022-07-13 bens Attached File- Added no-extra-slash-for-root-dir.patch, #53433
        StatusNone Ready For Test
    2022-07-13 bens SummaryCrash when trying to go below the root directory crash when trying to go above the root directory
    2022-07-13 bens Severity3 - Normal 5 - Blocker
        Assigned toNone bens

    Back to the top


    Powered by Savane 3.9