kopia lustrzana https://gitlab.com/sane-project/website
145 wiersze
6.1 KiB
HTML
145 wiersze
6.1 KiB
HTML
<!-- received="Thu Dec 10 04:50:23 1998 PST" -->
|
|
<!-- sent="Thu, 10 Dec 1998 13:48:40 +0100 (MET)" -->
|
|
<!-- name="becka@rz.uni-duesseldorf.de" -->
|
|
<!-- email="becka@rz.uni-duesseldorf.de" -->
|
|
<!-- subject="Re: PNM bugfix doesn't help" -->
|
|
<!-- id="199812101248.NAA00615@zeus.rz.uni-duesseldorf.de" -->
|
|
<!-- inreplyto="Pine.LNX.3.96.981209191550.19169C-100000@chef.ecs.soton.ac.uk" -->
|
|
<title>sane-devel: Re: PNM bugfix doesn't help</title>
|
|
<h1>Re: PNM bugfix doesn't help</h1>
|
|
<a href="mailto:becka@rz.uni-duesseldorf.de"><i>becka@rz.uni-duesseldorf.de</i></a><br>
|
|
<i>Thu, 10 Dec 1998 13:48:40 +0100 (MET)</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#130">[ date ]</a><a href="index.html#130">[ thread ]</a><a href="subject.html#130">[ subject ]</a><a href="author.html#130">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0131.html">Milon Firikis: "Interesting surfing. Competition ?"</a>
|
|
<li> <b>Previous message:</b> <a href="0129.html">Nick Lamb: "PNM bugfix doesn't help"</a>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
Hi !<br>
|
|
<p>
|
|
<i>> > If it is broken, it is probably largely my fault.</i><br>
|
|
<i>> Good, I'm talking to the right guy.</i><br>
|
|
<p>
|
|
Seems not. I haven't touched it for some time, and the bug below is<br>
|
|
quite surely not (c) by me.<br>
|
|
<p>
|
|
<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>
|
|
<i>> Well, the code you have here is totally different to the code in the</i><br>
|
|
<i>> SANE 1.0 source tarball I have. Sigh...</i><br>
|
|
<p>
|
|
ARGH ! I checked against 0.76, thinking noone has touched the thing<br>
|
|
sinc then.<br>
|
|
<p>
|
|
<i>> /* Suck in as much of the file as possible, since it's already in the</i><br>
|
|
<i>> correct format. */</i><br>
|
|
<i>> char *buf;</i><br>
|
|
<i>> int doread = parms.bytes_per_line;</i><br>
|
|
<i>> if (read_lines >= bry) </i><br>
|
|
<i>> return SANE_STATUS_EOF;</i><br>
|
|
<i>> buf = alloca(doread);</i><br>
|
|
<i>> len = fread (buf, 1, doread, infile);</i><br>
|
|
<p>
|
|
Hmm - this is simply wrong as far as I can tell.<br>
|
|
<p>
|
|
I'm just now downloading a copy to be able to make better comments. Sorry<br>
|
|
for the inconvenience. <br>
|
|
<p>
|
|
Who did that changes ?<br>
|
|
<p>
|
|
Hmmm: Changes written by G.ran Thyni <<a href="mailto:goran@bildbasen.se">goran@bildbasen.se</a>> but I'm not sure <br>
|
|
he's responsible for those changes.<br>
|
|
<p>
|
|
Anyway: Whoever does changes - could you make sure they do not break anything ?<br>
|
|
The PNM backend is a reference implementation. Not a playground.<br>
|
|
<p>
|
|
It is totally irrelevant, what it does. It is just there to look at and see<br>
|
|
how things are done.<br>
|
|
<p>
|
|
<i>> > Now let's have a look at the other branch ...</i><br>
|
|
<i>> [snipped, I'm sure both cases are broken, because the PNM backend is</i><br>
|
|
<i>> totally borked, and I'd like to see the author fix it, or rewrite it]</i><br>
|
|
<p>
|
|
*grin* Me too. I'll take care of it.<br>
|
|
<p>
|
|
It can't be, that the reference implementation backend is broken.<br>
|
|
<p>
|
|
<i>> Tested, doesn't fix it (because we're in the other branch by this point)</i><br>
|
|
<p>
|
|
Yes, but that doesn't matter any more, as the code is too much different from<br>
|
|
what I analyzed.<br>
|
|
<p>
|
|
<i>> Can't tell if it helps when Grayify/Three-pass are on, because they always</i><br>
|
|
<i>> return total gibberish anyway. Make the easy case work first?</i><br>
|
|
<p>
|
|
Yep. I'll make that work here some way and send diffs.<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>> > 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>
|
|
<i>> The SANE standard says I can pass any value for max_length, the PNM</i><br>
|
|
<i>> backend assumes I will always pass >= sizeof(one scanline), </i><br>
|
|
<p>
|
|
I didn't know it was _THAT_ broken in 1.0. Now I understand you being upset.<br>
|
|
<p>
|
|
The code I analyzed from 0.76 just broke in rare occasions, while the code<br>
|
|
snippet you sent suggest that it breaks _always_ ... !<br>
|
|
<p>
|
|
<i>> which is a totally bogus assumption. I notice on the list that at least one</i><br>
|
|
<i>> other backend makes such bogus assumptions.</i><br>
|
|
<p>
|
|
Yes. This is simply silly. The reason for having that maxlength parameter is<br>
|
|
to _avoid_ buffer overflows.<br>
|
|
<p>
|
|
<i>> Perhaps I should write a test frontend, that behaves badly to crash</i><br>
|
|
<i>> wrong-headed backends. </i><br>
|
|
<p>
|
|
Yes. Please !<br>
|
|
<p>
|
|
<p>
|
|
Use sane-read with widely varying max_sizes and adjust them up _and_ down<br>
|
|
in one scan.<br>
|
|
<p>
|
|
That would have crashed the old PNM backend as well.<br>
|
|
<p>
|
|
<i>> If I did this would the SANE developers agree to not allow distribution </i><br>
|
|
<i>> of backends that can't pass the test?</i><br>
|
|
<i>> [They are non-conforming by SANE standard]</i><br>
|
|
<p>
|
|
Interesting idea. We should consider that.<br>
|
|
<p>
|
|
<i>> Alternatively the standard could be revised to say "Backends reserve</i><br>
|
|
<i>> the right to copy any amount of data into the buffer, even if this</i><br>
|
|
<i>> causes overflows or the end of world civilisation, so there."</i><br>
|
|
*grin*. We should call that plan B :-).<br>
|
|
<p>
|
|
CU, Andy<br>
|
|
<p>
|
|
<pre>
|
|
--
|
|
Andreas Beck | Email : <<a href="mailto:Andreas.Beck@ggi-project.org">Andreas.Beck@ggi-project.org</a>>
|
|
<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="0131.html">Milon Firikis: "Interesting surfing. Competition ?"</a>
|
|
<li> <b>Previous message:</b> <a href="0129.html">Nick Lamb: "PNM bugfix doesn't help"</a>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
</ul>
|