Bug 185269 - xsane segfaults on startup
xsane segfaults on startup
Status: CLOSED INSUFFICIENT_DATA
Product: Fedora
Classification: Fedora
Component: xsane (Show other bugs)
rawhide
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Nils Philippsen
David Lawrence
bzcl34nup
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-12 20:56 EST by Brian Gerst
Modified: 2008-05-06 20:26 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-06 20:26:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Config files (2.31 KB, application/x-bzip2)
2006-03-14 07:42 EST, Brian Gerst
no flags Details
fix segfault (804 bytes, patch)
2006-04-04 11:09 EDT, Aldy Hernandez
no flags Details | Diff

  None (edit)
Description Brian Gerst 2006-03-12 20:56:52 EST
Description of problem:


Version-Release number of selected component (if applicable):
xsane-0.99-2.2

Steps to Reproduce:
1. Run xsane
  
Actual results:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47763756218320 (LWP 1296)]
0x0000000000440a57 in preferences_restore (fd=2376) at xsane-preferences.c:455
455         if (!strcmp(name, "medium-definitions"))

Expected results:
Runs.

Additional info:
Comment 1 Brian Gerst 2006-03-12 20:57:30 EST
Backtrace:

(gdb) bt
#0  0x0000000000440a57 in preferences_restore (fd=2376) at xsane-preferences.c:455
#1  0x000000000045bf9d in xsane_init (argc=1, argv=0x7fffff9c96a8) at xsane.c:1910
#2  0x000000000046863b in xsane_interface (argc=1, argv=0x7fffff9c96a8) at
xsane.c:5804
#3  0x0000000000469673 in main (argc=1, argv=0x7fffff9c96a8) at xsane.c:6053
#4  0x0000003b6d21d084 in __libc_start_main () from /lib64/libc.so.6
#5  0x0000000000408a29 in _start ()
#6  0x00007fffff9c9698 in ?? ()
#7  0x0000000000000000 in ?? ()
Comment 2 Takaki Hiroshi 2006-03-12 21:52:36 EST
How about 'rm -rf ~/.sane/xsane'?
Comment 3 Brian Gerst 2006-03-12 22:47:11 EST
That fixed it.  A bad config file shouldn't cause it to segfault though.
Comment 4 Nils Philippsen 2006-03-14 03:58:21 EST
I hope you have a backup of your config file, otherwise debugging the problem
might get (even more ;-) painful.
Comment 5 Brian Gerst 2006-03-14 07:42:33 EST
Created attachment 126097 [details]
Config files

Old config files
Comment 6 Aldy Hernandez 2006-04-04 11:09:07 EDT
Created attachment 127299 [details]
fix segfault

The problem happens while parsing an unknown preference string which is
followed by a number on the subsequent line.

In my case:

"mail-smtp-port"
25

In xsane-0.99-2.2 it looks like the new option is e-mail-smtp-port, not
mail-smtp-port.

In xsane-preferences.c:preferences_restore() we trigger an unknown identifier
on "mail-smtp-port", then when parsing 25, we realize it is not a string here:

    if (w.status == EINVAL) /* not a string */
    {
      w.status = 0;
      xsane_rc_io_w_skip_newline(&w); /* skip this line */
    }

but by then xsane_rc_io_w_string() has set <name> to NULL.

The problem happens when we try to dereference <name> here:

      else if (!strcmp(name, "medium-definitions"))

Notice this if is outside the scope where we know "name" to be a valid
identifier.

I am attaching a patch that fixes the problem.	An alternative solution is to
check that name is not null first.
Comment 7 Nils Philippsen 2006-04-04 12:06:27 EDT
I've updated the medium-definitions patch accordingly. Packages for Rawhide and
FC-5 are building right now.
Comment 8 Bug Zapper 2008-04-03 13:07:27 EDT
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 9 Bug Zapper 2008-05-06 20:26:29 EDT
This bug has been in NEEDINFO for more than 30 days since feedback was
first requested. As a result we are closing it.

If you can reproduce this bug in the future against a maintained Fedora
version please feel free to reopen it against that version.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

Note You need to log in before you can comment on or make changes to this bug.