[sane-devel] Possible Fujitsu Driver Bug

Chris Chesney cchesney@go-integral.com
Wed, 15 Oct 2003 15:52:03 -0500


This is a multi-part message in MIME format.

------_=_NextPart_001_01C3935E.2FDC604B
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hello,

=20

First off, I am new to this list (I just subscribed today), but have
done a few searches without finding anything related to my problem.

I have a Fujitsu 3091 scanner attached via SCSI to a RedHat 9 Compaq
Laptop.  I'm running version 1.0.12 of sane-backends.  We're creating a
custom application in Java using the japi wrapper code provided with
Sane.  The problem is that I was getting "5/38/0: Invalid field in parm
list" because of garbage in the fujitsu structure.  I tracked it down to
a problem in backend/fujitsu.c where the structure wasn't being
initialized after being allocated.  In the attachScanner function, I
added the 2 memset lines after these two sections of code.  This seemed
to fix the problem.  Let me know if you need more information.

=20

  if (NULL =3D=3D (dev =3D malloc (sizeof (*dev))))

    return SANE_STATUS_NO_MEM;

  memset(dev,'\0',sizeof(*dev));

=20

**

  if ((dev->buffer =3D malloc (dev->scsi_buf_size)) =3D=3D NULL)

    return SANE_STATUS_NO_MEM;

  memset(dev->buffer,'\0',sizeof(dev->scsi_buf_size));

=20

=20

As a side note, I've modified the japi wrapper code to be part of a
package so it can be used by other java packages and would be willing to
contribute that as well if you are interested.

=20

Best regards,

=20

Chris

=20


------_=_NextPart_001_01C3935E.2FDC604B
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
span.EmailStyle17
	{font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hello,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>First off, I am new to this list (I just subscribed =
today),
but have done a few searches without finding anything related to my =
problem.</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I have a Fujitsu 3091 scanner attached via SCSI to a =
RedHat
9 Compaq Laptop.&nbsp; I&#8217;m running version 1.0.12 of =
sane-backends.&nbsp;
We&#8217;re creating a custom application in Java using the japi wrapper =
code
provided with Sane.&nbsp; The problem is that I was getting =
&#8220;5/38/0:
Invalid field in parm list&#8221; because of garbage in the fujitsu =
structure.&nbsp;
I tracked it down to a problem in backend/fujitsu.c where the structure =
wasn&#8217;t
being initialized after being allocated. &nbsp;In the attachScanner =
function, I
added the 2 memset lines after these two sections of code.&nbsp; This =
seemed to
fix the problem.&nbsp; Let me know if you need more =
information.</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; if (NULL =3D=3D (dev =3D malloc (sizeof =
(*dev))))</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; return =
SANE_STATUS_NO_MEM;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; =
memset(dev,'\0',sizeof(*dev));</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>**</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; if ((dev-&gt;buffer =3D malloc =
(dev-&gt;scsi_buf_size))
=3D=3D NULL)</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; return =
SANE_STATUS_NO_MEM;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; =
memset(dev-&gt;buffer,'\0',sizeof(dev-&gt;scsi_buf_size));</span></font><=
/p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>As a side note, I&#8217;ve modified the japi wrapper =
code to
be part of a package so it can be used by other java packages and would =
be
willing to contribute that as well if you are =
interested.</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Best regards,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Chris</span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;</span></font></p>

</div>

</body>

</html>
=00
------_=_NextPart_001_01C3935E.2FDC604B--