produce broken scan image with snapscan S300 scanner
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libsane-perl (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
As I described in BTS of gscan2pdf, https:/
libsane-perl: Sane.xs have a bug when length=0 is returned from backend while sane_read().
It is occured with epjitsu backend driver that is used for Fujitsu SnapScan S300 scanner.
Sane.xs:
------------------
void
sane_read (handle, max_length)
SANE_Handle handle
SANE_Int max_length
INIT:
SANE_Status status;
PPCODE:
data = malloc (max_length);
status = sane_read (handle, data, max_length, &length);
SV* sv = get_sv(
if (status) {
}
XPUSHs(
}
--------------
when call newSVpv(data, length) with length=0, that means 'auto detect length of string of data'.
But length=0 should treat as 'no data'.
If (const char *)data consist by other than '\0', it happens that no-needed bytes is returned.
That is happend with S300 scaner and gscan2pdf, scanimage-perl, and scanadf-perl utilities.
ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: libsane-perl 0.03-1build1
ProcVersionSign
Uname: Linux 3.0.0-15-generic x86_64
NonfreeKernelMo
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Sat Feb 11 15:31:17 2012
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
ProcEnviron:
PATH=(custom, user)
LANG=ja_JP.UTF-8
SHELL=/bin/bash
SourcePackage: libsane-perl
UpgradeStatus: Upgraded to oneiric on 2011-12-24 (49 days ago)
An attached fix solves the problem. using newSVPvn(data, len): if len is zero, Perl will create a zero length string.