kopia lustrzana https://gitlab.com/sane-project/website
107 wiersze
4.8 KiB
HTML
107 wiersze
4.8 KiB
HTML
<!-- 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>> If it is broken, it is probably largely my fault.</i><br>
|
||
<p>
|
||
Good, I'm talking to the right guy.<br>
|
||
<p>
|
||
<i>> In what branch does that happen ?</i><br>
|
||
<i>> </i><br>
|
||
<i>> The sane-read request branches, if the "modifying" options are set.</i><br>
|
||
<i>> 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>> else</i><br>
|
||
<i>> /* Suck in as much of the file as possible, since it's already in the</i><br>
|
||
<i>> correct format. */</i><br>
|
||
<i>> 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 >= bry) <br>
|
||
return SANE_STATUS_EOF;<br>
|
||
buf = alloca(doread);<br>
|
||
len = fread (buf, 1, doread, infile);<br>
|
||
<p>
|
||
<i>> 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>> - len = fread (q, 1, rgblength - rgbleftover[0], infile);</i><br>
|
||
<i>> + len = fread (q, 1, 3*max_length - rgbleftover[0], infile);</i><br>
|
||
<i>> </i><br>
|
||
<i>> 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>> > If the PNM device has more data to send, it just writes past the end</i><br>
|
||
<i>> > of the buffer, </i><br>
|
||
<i>> </i><br>
|
||
<i>> Hey - it's not that bad. Just some overly clever code, which misbehaves</i><br>
|
||
<i>> when used in a somewhat unusual way. Who didn't make such a mistake once</i><br>
|
||
<i>> 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 >= 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>
|