sane-project-website/old-archive/1998-12/0129.html

107 wiersze
4.8 KiB
HTML
Czysty Wina Historia

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Thu Dec 10 02:41:01 1998 PST" -->
<!-- sent="Wed, 9 Dec 1998 19:33:22 +0000 (GMT)" -->
<!-- name="Nick Lamb" -->
<!-- email="njl98r@ecs.soton.ac.uk" -->
<!-- subject="PNM bugfix doesn't help" -->
<!-- id="" -->
<!-- inreplyto="m0znXVz-000CHLC@hades.beck-sw.de" -->
<title>sane-devel: PNM bugfix doesn't help</title>
<h1>PNM bugfix doesn't help</h1>
<b>Nick Lamb</b> (<a href="mailto:njl98r@ecs.soton.ac.uk"><i>njl98r@ecs.soton.ac.uk</i></a>)<br>
<i>Wed, 9 Dec 1998 19:33:22 +0000 (GMT)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#129">[ date ]</a><a href="index.html#129">[ thread ]</a><a href="subject.html#129">[ subject ]</a><a href="author.html#129">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0130.html">becka@rz.uni-duesseldorf.de: "Re: PNM bugfix doesn't help"</a>
<li> <b>Previous message:</b> <a href="0128.html">Pascal Bonete: "Re:- Pacific Image Electronics 630P ?"</a>
<li> <b>In reply to:</b> <a href="0115.html">becka@rz.uni-duesseldorf.de: "Re: Bit of a rant, bug in PNM"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
On Wed, 9 Dec 1998 <a href="mailto:becka@rz.uni-duesseldorf.de">becka@rz.uni-duesseldorf.de</a> wrote:<br>
<p>
<i>&gt; If it is broken, it is probably largely my fault.</i><br>
<p>
Good, I'm talking to the right guy.<br>
<p>
<i>&gt; In what branch does that happen ?</i><br>
<i>&gt; </i><br>
<i>&gt; The sane-read request branches, if the "modifying" options are set.</i><br>
<i>&gt; If neither grayify nor three-pass-emulation are set, all should be well:</i><br>
<p>
Yes, I have neither grayify NOR three-pass-emulation set, I am using<br>
the default settings and doing a preview scan.<br>
<p>
<i>&gt; else</i><br>
<i>&gt; /* Suck in as much of the file as possible, since it's already in the</i><br>
<i>&gt; correct format. */</i><br>
<i>&gt; len = fread (data, 1, max_length, infile);</i><br>
<p>
Well, the code you have here is totally different to the code in the<br>
SANE 1.0 source tarball I have. Sigh...<br>
<p>
/* Suck in as much of the file as possible, since it's already in the<br>
correct format. */<br>
char *buf;<br>
int doread = parms.bytes_per_line;<br>
if (read_lines &gt;= bry) <br>
return SANE_STATUS_EOF;<br>
buf = alloca(doread);<br>
len = fread (buf, 1, doread, infile);<br>
<p>
<i>&gt; Now let's have a look at the other branch ...</i><br>
<p>
[snipped, I'm sure both cases are broken, because the PNM backend is<br>
totally borked, and I'd like to see the author fix it, or rewrite it]<br>
<p>
<i>&gt; - len = fread (q, 1, rgblength - rgbleftover[0], infile);</i><br>
<i>&gt; + len = fread (q, 1, 3*max_length - rgbleftover[0], infile);</i><br>
<i>&gt; </i><br>
<i>&gt; Could you test/confirm that ? Otherwise we'd need to look for a "real" fix.</i><br>
<p>
Tested, doesn't fix it (because we're in the other branch by this point)<br>
Can't tell if it helps when Grayify/Three-pass are on, because they always<br>
return total gibberish anyway. Make the easy case work first?<br>
<p>
<i>&gt; &gt; If the PNM device has more data to send, it just writes past the end</i><br>
<i>&gt; &gt; of the buffer, </i><br>
<i>&gt; </i><br>
<i>&gt; Hey - it's not that bad. Just some overly clever code, which misbehaves</i><br>
<i>&gt; when used in a somewhat unusual way. Who didn't make such a mistake once</i><br>
<i>&gt; upon a time ?</i><br>
<p>
The SANE standard says I can pass any value for max_length, the PNM<br>
backend assumes I will always pass &gt;= sizeof(one scanline), which is<br>
a totally bogus assumption. I notice on the list that at least one<br>
other backend makes such bogus assumptions.<br>
<p>
Perhaps I should write a test frontend, that behaves badly to crash<br>
wrong-headed backends. If I did this would the SANE developers agree to<br>
not allow distribution of backends that can't pass the test?<br>
[They are non-conforming by SANE standard]<br>
<p>
Alternatively the standard could be revised to say "Backends reserve<br>
the right to copy any amount of data into the buffer, even if this<br>
causes overflows or the end of world civilisation, so there."<br>
<p>
Nick.<br>
<p>
<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">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0130.html">becka@rz.uni-duesseldorf.de: "Re: PNM bugfix doesn't help"</a>
<li> <b>Previous message:</b> <a href="0128.html">Pascal Bonete: "Re:- Pacific Image Electronics 630P ?"</a>
<li> <b>In reply to:</b> <a href="0115.html">becka@rz.uni-duesseldorf.de: "Re: Bit of a rant, bug in PNM"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>