bugDatabase-driven manual pager suite - Bugs: bug #45861, segfault when cwd is unreadable

 
 

bug #45861: segfault when cwd is unreadable

Submitted by:  Mike Frysinger <vapier>
Submitted on:  Wed 02 Sep 2015 01:44:53 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Colin Watson <cjwatson>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 09 Sep 2015 03:21:28 PM UTC, comment #1:

Thanks for the patch! Pushed:

http://git.savannah.gnu.org/cgit/man-db.git/commit/?id=12153a4d806e9f32585c80707ae25e60b541f796

Colin Watson <cjwatson>
Project AdministratorIn charge of this item.
Wed 02 Sep 2015 01:44:53 AM UTC, original submission:

if in you're a dir that no longer exists, then man segfaults. patch attached fixes the issue.

this is because the global cwd struct in man.c is not initialized, and the make_display_command function doesn't check if have_cwd is set before trying to use cwd.

$ sleep 10 &
$ cd /proc/$!
$ fg
$ gdb --args man man
...
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00007ffff75a16e9 in xstrdup (string=0x0) at /var/tmp/portage/dev-libs/libpipeline-1.4.1/work/libpipeline-1.4.1/gnulib/lib/xmalloc.c:121
#2 0x00007ffff759cfdd in pipecmd_chdir (cmd=cmd@entry=0x710e70, directory=0x0) at /var/tmp/portage/dev-libs/libpipeline-1.4.1/work/libpipeline-1.4.1/lib/pipeline.c:545
#3 0x0000000000408e61 in make_display_command (encoding=encoding@entry=0x710460 "UTF-8", title=title@entry=0x6fd4e0 "man(1)") at man.c:1611
#4 0x000000000040ab28 in display (dir=<optimized out>, man_file=man_file@entry=0x622060 "/usr/share/man/man1/man.1.xz", cat_file=cat_file@entry=0x710110 "/var/cache/man/cat1/man.1.gz", title=title@entry=0x6fd4e0 "man(1)", dbfilters=dbfilters@entry=0x0) at man.c:2381
#5 0x000000000040c289 in display_filesystem (candp=0x62fd20) at man.c:3112
#6 display_pages (candidates=<optimized out>) at man.c:3513
#7 man (name=name@entry=0x7fffffffd856 "man", found=found@entry=0x7fffffffd2ec) at man.c:3849
#8 0x0000000000404e18 in main (argc=0x2, argv=0x7fffffffd4e8) at man.c:4147

reported here:
https://bugs.gentoo.org/559228

Mike Frysinger <vapier>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #34790:  man-db-cwd-crash.patch added by vapier (555B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cjwatson (Posted a comment)
  • -unavailable- added by vapier (Submitted 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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 09 Sep 2015 03:21:28 PM UTCcjwatsonStatusNone=>Fixed
      Assigned toNone=>cjwatson
      Open/ClosedOpen=>Closed
    Wed 02 Sep 2015 01:44:53 AM UTCvapierAttached File-=>Added man-db-cwd-crash.patch, #34790

    Back to the top


    Powered by Savane 3.1-cleanup1