Bug 4497 - xcam segfaults
Summary: xcam segfaults
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: D Morgan
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-12 16:14 CET by Chris Denice
Modified: 2012-04-19 21:20 CEST (History)
2 users (show)

See Also:
Source RPM: sane-frontends-1.0.14-11.mga1.src.rpm
CVE:
Status comment:


Attachments
xcam bt under gdb (776 bytes, text/plain)
2012-02-13 08:57 CET, Chris Denice
Details

Description Chris Denice 2012-02-12 16:14:13 CET
Description of problem:

Try the start xcam, the standalone front-end prog of sane:


[chris@]$ xcam 
Gtk-Message: Failed to load module "canberra-gtk-module"
Segmentation fault


Cheers,
chris.
Comment 1 Manuel Hiebel 2012-02-13 01:06:21 CET
please do the following:
1) enable the "core release debug"
2) install the following packages: gdb xcam-debug
3) run the following command from a terminal:
   gdb -q xcam
4) then type "run"
5) when it segfaults, type "bt" and copy back the stack trace in a file you'll
attach (not paste) to this bug report
Thanks

Keywords: (none) => NEEDINFO

Comment 2 Chris Denice 2012-02-13 08:57:54 CET
Created attachment 1538 [details]
xcam bt under gdb

Here the bt.
Manuel Hiebel 2012-02-14 00:01:14 CET

Attachment 1538 mime type: text/x-log => text/plain

Comment 3 Manuel Hiebel 2012-02-14 00:02:30 CET
Ok thanks 

Dmorgan any ideas ?

Assignee: bugsquad => dmorganec

Marja Van Waes 2012-03-03 07:30:43 CET

Keywords: NEEDINFO => (none)
CC: (none) => marja11

Comment 4 Pascal Terjan 2012-04-19 21:01:41 CEST
First this happens after it found a device but failed to use it (it happens here because I am missing the firmware for the scanner on this machine).

While reading the code, I also noticed several bugs and I wonder if anyone is using it...

In load_defaults the code is:

  char filename[PATH_MAX];
  int fd;

  DBG (DBG_debug, "xcam, load_defaults: enter\n");
  if (make_default_filename (sizeof (filename), filename, dialog->dev_name)
      < 0)
    return;
  if (fd < 0)
    return;
  load_settings (filename, silent);
  sanei_load_values (fd, dialog->dev);
  DBG (DBG_debug, "xcam, load_defaults: exit\n");

Which means fd is never initialized, it is obviously missing a "fd = open(filename, O_RDONLY);" before "if (fd < 0)"

In save_frame_button there is testfilename[sizeof (testfilename)] = 0; which should be testfilename[sizeof (testfilename)-1]

In switch_device the code checks if dialog is NULL (in case the device could not be open) to not use it, but most of the rest of the code does not and will segfault.

This code was written in 1997 and updated in 2005 but seems very buggy and not maintained. I can write a few patches to fix the most obvious bugs but I would suggest to not use xcam.

CC: (none) => pterjan

Comment 5 Pascal Terjan 2012-04-19 21:04:53 CEST
Hmm some of them are actually fixed in git but there was no release since 2005.
Comment 6 Chris Denice 2012-04-19 21:11:59 CEST
Hi,
if there is indeed no user, you can drop it. Myself, I did not mean to use it when I found the bug; it hust poped up on a mistyped bash-completion tab :D

Cheers,
Chris.
Comment 7 Pascal Terjan 2012-04-19 21:20:01 CEST
I fixed the segfault and uploaded the package.

Status: NEW => RESOLVED
Resolution: (none) => FIXED


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