sane-project-website/old-archive/2000-09/0260.html

226 wiersze
7.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: pnm backend crashes graphical frontends (patch?)</TITLE>
<META NAME="Author" CONTENT="Henning Meier-Geinitz (hmg-ml@gmx.de)">
<META NAME="Subject" CONTENT="Re: pnm backend crashes graphical frontends (patch?)">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: pnm backend crashes graphical frontends (patch?)</H1>
<!-- received="Mon Sep 25 11:58:45 2000" -->
<!-- isoreceived="20000925185845" -->
<!-- sent="Mon, 25 Sep 2000 21:09:44 +0200" -->
<!-- isosent="20000925190944" -->
<!-- name="Henning Meier-Geinitz" -->
<!-- email="hmg-ml@gmx.de" -->
<!-- subject="Re: pnm backend crashes graphical frontends (patch?)" -->
<!-- id="20000925210944.C10590@hmg1.vortex.swb.de" -->
<!-- inreplyto="00092510593600.00347@slowcrap" -->
<STRONG>From:</STRONG> Henning Meier-Geinitz (<A HREF="mailto:hmg-ml@gmx.de?Subject=Re:%20pnm%20backend%20crashes%20graphical%20frontends%20(patch?)&In-Reply-To=&lt;20000925210944.C10590@hmg1.vortex.swb.de&gt;"><EM>hmg-ml@gmx.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Mon Sep 25 2000 - 12:09:44 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0261.html">Henning Meier-Geinitz: "SANE BeOS port"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0259.html">Bruce DeVisser: "HP 5100C debugging help needed"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0254.html">mh: "pnm backend crashes graphical frontends (patch?)"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0267.html">mh: "Re: pnm backend crashes graphical frontends (patch?)"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0267.html">mh: "Re: pnm backend crashes graphical frontends (patch?)"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#260">[ date ]</A>
<A HREF="index.html#260">[ thread ]</A>
<A HREF="subject.html#260">[ subject ]</A>
<A HREF="author.html#260">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P>On Mon, Sep 25, 2000 at 10:50:47AM +0200, mh wrote:
<BR>
<EM>&gt; I don't know, whether this is of interest, since I can't find it on the
</EM><BR>
<EM>&gt; TODO list.
</EM><BR>
<P>If something crashes in SANE it will be always of interest :-)
<BR>
<P><EM>&gt; It seems that the pnm backend (still) randomly crashes the graphical
</EM><BR>
<EM>&gt; frontends.
</EM><BR>
<EM>&gt; (activate &quot;Three-Pass Simulation&quot;-&gt;scan preview-&gt;deactivate
</EM><BR>
<EM>&gt; &quot;Three-Pass Simulation&quot;-&gt;activate &quot;Grayify&quot; and &quot;Hand-Scanner
</EM><BR>
<EM>&gt; Simulation&quot;-&gt;scan preview-&gt;crash)
</EM><BR>
<P>I can't reproduce this here (no crash) but this needn't mean anything.
<BR>
<P><EM>&gt; IMHO the problem is a static variable which is used as a counter
</EM><BR>
<EM>&gt; for an array. This one &quot;points&quot; outside the array under several
</EM><BR>
<EM>&gt; circumstances.
</EM><BR>
<P>Are you talking about rgbleftover? Where exactly does the pnm backend crash?
<BR>
<P><EM>&gt; Can someone test the attached patch (for pnm.c in Sane-1.0.3) and
</EM><BR>
<EM>&gt; confirm that it fixes the problem? (it does for me)
</EM><BR>
<P>I didn't look too close at the code but are you sure that moving the three
<BR>
variables inside the function will cure the segfaults? Isn't this just good
<BR>
luck?
<BR>
<P>Could you locate the exact problem with gdb?
<BR>
<P>While trying to reproduce &quot;your&quot; bug I found another one: pnm.c doesn't like
<BR>
changing the frame type and bit depth during runtime! If you load a 1 bit
<BR>
lineart pnm and than a 8 bit gray --&gt; segfault (in the frontend preview). If
<BR>
you load a grayscale (8 bit) and then color (3*8 bit) -&gt; segfault. pnm.c
<BR>
initializes params.dpth and ppm_type at the beginning but not after a change
<BR>
of the input image (at least not in every case).
<BR>
<P>This reveals another problem: xscanimage doesn't test if it gets too much
<BR>
data from the backend (at least in preview mode).
<BR>
<P>Here is a patch for pnm.c (against latest cvs). This is just a quick hack. I
<BR>
will look more closely at pnm.c during the next days/weeks. Maybe I can find
<BR>
other bugs. Any ideas for fixes or addional features?
<BR>
<P>Bye,
<BR>
&nbsp;&nbsp;Henning
<BR>
<P><P>Index: backend/pnm.c
<BR>
===================================================================
<BR>
RCS file: /cvsroot/external/sane/backend/pnm.c,v
<BR>
retrieving revision 1.2
<BR>
diff -u -r1.2 pnm.c
<BR>
--- pnm.c 2000/08/12 15:09:29 1.2
<BR>
+++ pnm.c 2000/09/25 19:06:19
<BR>
@@ -414,17 +414,21 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Binary monochrome. */
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parms.depth = 1;
<BR>
- gray = SANE_TRUE;
<BR>
-
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ppm_type = ppm_bitmap;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;&nbsp;else if (!strncmp (buf, &quot;P5&quot;, 2))
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Grayscale. */
<BR>
- gray = SANE_TRUE;
<BR>
+ parms.depth = 8;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ppm_type = ppm_greyscale;
<BR>
+ }
<BR>
+ else if (!strncmp (buf, &quot;P6&quot;, 2))
<BR>
+ {
<BR>
+ /* Color. */
<BR>
+ parms.depth = 8;
<BR>
+ ppm_type = ppm_color;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
- else if (strncmp (buf, &quot;P6&quot;, 2))
<BR>
+ else
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBG(2, &quot;%s is not a recognized PPM\n&quot;, filename);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fclose (fn);
<BR>
@@ -444,7 +448,7 @@
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parms.lines = -1;
<BR>
&nbsp;&nbsp;&nbsp;else
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parms.lines = y;
<BR>
- if (gray)
<BR>
+ if ((ppm_type == ppm_greyscale) || (ppm_type == ppm_bitmap) || gray)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parms.format = SANE_FRAME_GRAY;
<BR>
&nbsp;&nbsp;&nbsp;else
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
<P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20pnm%20backend%20crashes%20graphical%20frontends%20(patch?)&In-Reply-To=&lt;20000925210944.C10590@hmg1.vortex.swb.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0261.html">Henning Meier-Geinitz: "SANE BeOS port"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0259.html">Bruce DeVisser: "HP 5100C debugging help needed"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0254.html">mh: "pnm backend crashes graphical frontends (patch?)"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0267.html">mh: "Re: pnm backend crashes graphical frontends (patch?)"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0267.html">mh: "Re: pnm backend crashes graphical frontends (patch?)"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#260">[ date ]</A>
<A HREF="index.html#260">[ thread ]</A>
<A HREF="subject.html#260">[ subject ]</A>
<A HREF="author.html#260">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Mon Sep 25 2000 - 11:59:44 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>