Bug 185269

Summary: xsane segfaults on startup
Product: [Fedora] Fedora Reporter: Brian Gerst <brgerst>
Component: xsaneAssignee: Nils Philippsen <nphilipp>
Status: CLOSED INSUFFICIENT_DATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: aldyh, triage, urorzm+bugzilla.redhat.com
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-07 00:26:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Config files
none
fix segfault none

Description Brian Gerst 2006-03-13 01:56:52 UTC
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-13 01:57:30 UTC
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 urorzm+bugzilla.redhat.com 2006-03-13 02:52:36 UTC
How about 'rm -rf ~/.sane/xsane'?

Comment 3 Brian Gerst 2006-03-13 03:47:11 UTC
That fixed it.  A bad config file shouldn't cause it to segfault though.

Comment 4 Nils Philippsen 2006-03-14 08:58:21 UTC
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 12:42:33 UTC
Created attachment 126097 [details]
Config files

Old config files

Comment 6 Aldy Hernandez 2006-04-04 15:09:07 UTC
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 16:06:27 UTC
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 17:07:27 UTC
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-07 00:26:29 UTC
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