Skip Menu |

This queue is for tickets about the Sane CPAN distribution.

Maintainer(s)' notes

This queue is shared by both Sane and sane at the moment. Please make it clear in your bug report which distribution you're addressing.

Report information
The Basics
Id: 74864
Status: open
Priority: 0/
Queue: Sane

People
Owner: Nobody in particular
Requestors: miurahr [...] linux.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: (no value)



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);
On Sat Feb 11 03:02:01 2012, https://launchpad.net/~miurahr wrote: Show quoted text
> 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.
Thanks for the patch, which is included in 0.04