Bug#901353: wmifs segfaults occasionally

anomie at users.sourceforge.net anomie at users.sourceforge.net
Mon Jun 11 20:42:26 BST 2018


Package: wmifs
Version: 1.8-1

I noticed that wmifs was randomly crashing on my laptop. I have no idea
how to reproduce it besides letting it run for a long time, it didn't
seem to be associated with hibernation or anything else obvious. If I
have multiple instances running, usually only one will crash while the
others continue without issue.

Running it under gdb with wmifs-dbgsym installed produced this trace:

  Program received signal SIGSEGV, Segmentation fault.
  _IO_fgets (buf=0x7fffffffd9d0 "\001", n=512, fp=0x0) at iofgets.c:47
  47	iofgets.c: No such file or directory.
  (gdb) bt
  #0  _IO_fgets (buf=0x7fffffffd9d0 "\001", n=512, fp=0x0) at iofgets.c:47
  #1  0x0000555555556d1f in fgets (__stream=0x0, __n=512, __s=0x7fffffffd9d0 "\001") at /usr/include/x86_64-linux-gnu/bits/stdio2.h:263
  #2  get_statistics (devname=<optimized out>, ip=0x7fffffffdc70, op=0x7fffffffdc78, is=0x7fffffffdc80, os=0x7fffffffdc88) at wmifs.c:767
  #3  0x00005555555573b9 in wmifs_routine (argc=<optimized out>, argv=<optimized out>) at wmifs.c:555
  #4  0x0000555555555dbe in main (argc=5, argv=0x7fffffffe198) at wmifs.c:367

Apparently the fopen() on wmifs.c line 766 can fail in some cases, and
that needs to be checked for to avoid passing a NULL file pointer to
fgets(). It could be as simple as inserting

    if (!fp) {
        return -1;
    }

to match the minimal error handling on subsequent lines when an fgets() fails.



More information about the Pkg-wmaker-devel mailing list