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

 
 

bug #45861: segfault when cwd is unreadable

Submitter:  Mike Frysinger <vapier>
Submitted:  Wed 02 Sep 2015 01:44:53 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  cjwatson
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 09 Sep 2015 03:21:28 PM UTC, comment #1: 
Colin Watson <cjwatson>
Group administrator
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 Files:
   
   
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
  • -email is unavailable- added by cjwatson (Posted a comment)
  • -email is unavailable- added by vapier (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.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-09 cjwatson StatusNone Fixed
        Assigned toNone cjwatson
        Open/ClosedOpen Closed
    2015-09-02 vapier Attached File- Added man-db-cwd-crash.patch, #34790

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code