Public bug reported:

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)

** Affects: sane-backends (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 trusty

** Attachment added: "sane.tar.gz"
   
https://bugs.launchpad.net/bugs/1557812/+attachment/4600608/+files/sane.tar.gz

** Description changed:

  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;
-     }
+    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;
-     }
+  /* 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.23-3ubuntu3.1
+ 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)

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to sane-backends in Ubuntu.
https://bugs.launchpad.net/bugs/1557812

Title:
  SEGFAULT when reinitializing a scanner

Status in sane-backends package in Ubuntu:
  New

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1557812/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to