SEGFAULT when reinitializing a scanner

Bug #1557812 reported by Dmitry
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
sane-backends (Ubuntu)
Expired
Low
Unassigned

Bug Description

I have Canon Lide 220. I have libsane from Xenial (1.0.25) compiled with debuild. If I initialize the scanner with sane_open(), then immediately de-initialize it with sane_close(), and then sane_open() again, sane_start() will crash after that. The crash happens in genesys_low.c/sanei_genesys_generate_gamma_buffer() line #1240:

value=dev->sensor.gamma_table[GENESYS_RED][i];

The issue is that if I reinitialize the scanner, its gamma table is lost (dev->sensor.gamma_table). After reinitializing sane_start() tries to use non-initialized gamma table and crashes. Possible WORKAROUND, NOT A FIX:

In genesys_low.c/sanei_genesys_asic_init() line #1378 find and comment out the following code:

   if (dev->already_initialized && !cold)
    {
      DBG (DBG_info, "%s: already initialized, nothing to do\n", __FUNCTION__);
      return SANE_STATUS_GOOD;
    }

So it becomes

 /* if (dev->already_initialized && !cold)
    {
      DBG (DBG_info, "%s: already initialized, nothing to do\n", __FUNCTION__);
      return SANE_STATUS_GOOD;
    }
*/

After this ugly hack sane will reinitialize the gamma table every time, and the application will not crash. Sample C++ app is attached. Simply compile and run with Lide 220 connected.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: libsane 1.0.25+git20150528-1ubuntu2
ProcVersionSignature: Ubuntu 3.13.0-66.108-generic 3.13.11-ckt27
Uname: Linux 3.13.0-66-generic i686
ApportVersion: 2.14.1-0ubuntu3.19
Architecture: i386
CurrentDesktop: KDE
Date: Tue Mar 15 17:36:02 2016
InstallationDate: Installed on 2015-10-24 (144 days ago)
InstallationMedia: Kubuntu 14.04.3 LTS "Trusty Tahr" - Beta i386 (20150805)
SourcePackage: sane-backends
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dmitry (dmitrymq) wrote :
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sane-backends (Ubuntu):
status: New → Confirmed
Revision history for this message
penalvch (penalvch) wrote :

Dmitry, thank you for reporting this and helping make Ubuntu better.

To see if this is already resolved in Ubuntu, could you please test http://cdimage.ubuntu.com/daily-live/current/ and advise to the results?

Changed in sane-backends (Ubuntu):
importance: Undecided → Low
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for sane-backends (Ubuntu) because there has been no activity for 60 days.]

Changed in sane-backends (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.