Subject: | sane_read returns unwanted data when length=0 |
Problem is observed when used with gscan2pdf and Fujitsu snapscan S300.
https://sourceforge.net/tracker/?func=detail&aid=3485387&group_id=174140&atid=868098
https://bugs.launchpad.net/ubuntu/+source/libsane-perl/+bug/930552
An attached patch resolves problem.
When length is 0, newSVpv(data, length) use strlen(data) as length. If
data contains other than '\0' unwanted data will be return.
We should use newSVpvn(data, length) instead.
Subject: | libsane-perl-0.03-sane_read-length-0-fix.patch |
--- libsane-perl-0.03/Sane.xs.orgi 2012-02-11 16:24:17.513757491 +0900
+++ libsane-perl-0.03/Sane.xs 2012-02-11 16:47:04.615021432 +0900
@@ -281,7 +281,7 @@
XPUSHs(sv_2mortal(newSViv(0)));
}
else {
- XPUSHs(sv_2mortal(newSVpv(data, length)));
+ XPUSHs(sv_2mortal(newSVpvn(data, length)));
XPUSHs(sv_2mortal(newSViv(length)));
}
free (data);