sane-project-website/old-archive/2001-04/0307.html

388 wiersze
12 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: scanimage -T using Purify...</TITLE>
<META NAME="Author" CONTENT="Henning Meier-Geinitz (henning@meier-geinitz.de)">
<META NAME="Subject" CONTENT="Re: scanimage -T using Purify...">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: scanimage -T using Purify...</H1>
<!-- received="Sun Apr 29 07:49:59 2001" -->
<!-- isoreceived="20010429144959" -->
<!-- sent="Sun, 29 Apr 2001 16:56:03 +0200" -->
<!-- isosent="20010429145603" -->
<!-- name="Henning Meier-Geinitz" -->
<!-- email="henning@meier-geinitz.de" -->
<!-- subject="Re: scanimage -T using Purify..." -->
<!-- id="20010429165603.A31678@vortex.swb.de" -->
<!-- inreplyto="E14tqrk-0004IJ-00@minerva" -->
<STRONG>From:</STRONG> Henning Meier-Geinitz (<A HREF="mailto:henning@meier-geinitz.de?Subject=Re:%20scanimage%20-T%20using%20Purify...&In-Reply-To=&lt;20010429165603.A31678@vortex.swb.de&gt;"><EM>henning@meier-geinitz.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Sun Apr 29 2001 - 07:56:03 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0308.html">Petter Reinholdtsen: "Re: scanimage -T using Purify..."</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0306.html">John Buell: "Re: [discuss] SANE support"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0303.html">Petter Reinholdtsen: "scanimage -T using Purify..."</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0308.html">Petter Reinholdtsen: "Re: scanimage -T using Purify..."</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#307">[ date ]</A>
<A HREF="index.html#307">[ thread ]</A>
<A HREF="subject.html#307">[ subject ]</A>
<A HREF="author.html#307">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P>On Sun, Apr 29, 2001 at 03:03:56PM +0200, Petter Reinholdtsen wrote:
<BR>
<EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; UMR: Uninitialized memory read (2 times):
</EM><BR>
<EM>&gt; * This is occurring while in:
</EM><BR>
<EM>&gt; sanei_config_read [sanei_config.c:194]
</EM><BR>
<EM>&gt; sane_umax_init [umax.c:5350]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<EM>&gt; sane_get_devices [dll-s.c:15]
</EM><BR>
<EM>&gt; main [scanimage.c:1468]
</EM><BR>
<EM>&gt; * Reading 1 byte from 0xffbeec0f on the stack.
</EM><BR>
<EM>&gt; * Address 0xffbeec0f is 1041 bytes below frame pointer in function sane_umax_init.
</EM><BR>
<P>I don't know if this is really the culprit:
<BR>
<P>In sanei_config_read there is the following code:
<BR>
<P>&nbsp;&nbsp;&nbsp;len = strlen( str);
<BR>
&nbsp;&nbsp;&nbsp;while( isspace( str[--len]))
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str[len] = '\0';
<BR>
<P>Ok, if we have a str containing &quot;\n&quot; (empty line), len
<BR>
will be 1 and str[--len] is '\n' and after that len = 0. Next step:
<BR>
len is 0, --len is -1 --&gt; str[-1] !
<BR>
<P>Something like
<BR>
<P>&nbsp;&nbsp;&nbsp;while((len &gt; 0) &amp;&amp; (isspace(str[--len])))
<BR>
<P>should fix this. Petter, can you check this with purify?
<BR>
<P><EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; UMR: Uninitialized memory read (2 times):
</EM><BR>
<EM>&gt; * This is occurring while in:
</EM><BR>
<EM>&gt; sane_umax_init [umax.c:5337]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<EM>&gt; sane_get_devices [dll-s.c:15]
</EM><BR>
<EM>&gt; main [scanimage.c:1468]
</EM><BR>
<EM>&gt; _start [crt1.o]
</EM><BR>
<EM>&gt; * Reading 1 byte from 0xffbeec0f on the stack.
</EM><BR>
<EM>&gt; * Address 0xffbeec0f is 1041 bytes below frame pointer in function sane_umax_init.
</EM><BR>
<P>umax.c:
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;len = strlen (config_line);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if (config_line[len - 1] == '\n')
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;config_line[--len] = '\0';
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
<P>What happens if len==0? Similar things are probably in many backends.
<BR>
<P>[snipped all the sanei_config read stuff]
<BR>
<P><EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; UMR: Uninitialized memory read:
</EM><BR>
<EM>&gt; * This is occurring while in:
</EM><BR>
<EM>&gt; sane_plustek_init [plustek.c:800]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<EM>&gt; sane_get_devices [dll-s.c:15]
</EM><BR>
<EM>&gt; main [scanimage.c:1468]
</EM><BR>
<EM>&gt; _start [crt1.o]
</EM><BR>
<EM>&gt; * Reading 1 byte from 0xffbeec0f on the stack.
</EM><BR>
<EM>&gt; * Address 0xffbeec0f is 1041 bytes below frame pointer in function sane_plustek_init.
</EM><BR>
<P>plustek.c:
<BR>
<P>&nbsp;&nbsp;len = strlen(dev_name);
<BR>
&nbsp;&nbsp;if( dev_name[len - 1] == '\n' )
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;dev_name[--len] = '\0';
<BR>
<P>That's similar.
<BR>
<P><EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; UMR: Uninitialized memory read:
</EM><BR>
<EM>&gt; * This is occurring while in:
</EM><BR>
<EM>&gt; sane_artec_init [artec.c:2570]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<EM>&gt; sane_get_devices [dll-s.c:15]
</EM><BR>
<EM>&gt; main [scanimage.c:1468]
</EM><BR>
<EM>&gt; _start [crt1.o]
</EM><BR>
<EM>&gt; * Reading 4 bytes from 0xffbef084 on the stack.
</EM><BR>
<EM>&gt; * Address 0xffbef084 is local variable &quot;version&quot; in function init.
</EM><BR>
<P>artec.c:
<BR>
<P>&nbsp;&nbsp;DBG (7, &quot;sane_init( version_code = %d, callback() = %p )\n&quot;,
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*version_code, authorize );
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>
version_code may be NULL!
<BR>
<P><EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; UMR: Uninitialized memory read (3 times):
</EM><BR>
<EM>&gt; * This is occurring while in:
</EM><BR>
<EM>&gt; bin_w_word [sanei_codec_bin.c:98]
</EM><BR>
<EM>&gt; sanei_w_word [sanei_wire.c:215]
</EM><BR>
<EM>&gt; sanei_w_array [sanei_wire.c:160]
</EM><BR>
<EM>&gt; w_option_value [sanei_net.c:125]
</EM><BR>
<EM>&gt; sanei_w_control_option_req [sanei_net.c:148]
</EM><BR>
<EM>&gt; sanei_w_call [sanei_wire.c:405]
</EM><BR>
<EM>&gt; * Reading 4 bytes from 0xffbef16c on the stack.
</EM><BR>
<P>Don't know.
<BR>
<P><EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; Current file descriptors in use: 7
</EM><BR>
<EM>&gt; FIU: file descriptor 0: &lt;stdin&gt;
</EM><BR>
<EM>&gt; FIU: file descriptor 1: &lt;stdout&gt;
</EM><BR>
<EM>&gt; FIU: file descriptor 2: &lt;stderr&gt;
</EM><BR>
<EM>&gt; FIU: file descriptor 3: &quot;/export/home/pere/gnu/etc/sane.d/net.conf&quot;, O_RDONLY
</EM><BR>
<EM>&gt; * File info: srw-rw-rw- 0 root root 0 Apr 29 13:39
</EM><BR>
<EM>&gt; * This file descriptor was allocated from:
</EM><BR>
<EM>&gt; __open [libc.so.1]
</EM><BR>
<EM>&gt; _open [libc.so.1]
</EM><BR>
<EM>&gt; _endopen [libc.so.1]
</EM><BR>
<EM>&gt; fopen [libc.so.1]
</EM><BR>
<EM>&gt; sanei_config_open [sanei_config.c:119]
</EM><BR>
<EM>&gt; sane_net_init [net.c:355]
</EM><BR>
<P>Does this mean the file descriptor for net.conf is still open? I don't
<BR>
understand this because there IS a fclose.
<BR>
<P><EM>&gt; FIU: file descriptor 4: &quot;/etc/.name_service_door&quot;, O_RDONLY
</EM><BR>
<EM>&gt; * File info: ?r--r--r-- 1 root root 0 Apr 26 2000
</EM><BR>
<EM>&gt; * This file descriptor was allocated from:
</EM><BR>
<EM>&gt; __open64 [libc.so.1]
</EM><BR>
<EM>&gt; _open64 [libc.so.1]
</EM><BR>
<EM>&gt; _nsc_trydoorcall [libc.so.1]
</EM><BR>
<EM>&gt; _door_gethostbyname_r [gethostby_door.c]
</EM><BR>
<EM>&gt; _get_hostserv_inetnetdir_byname [netdir_inet.c]
</EM><BR>
<EM>&gt; gethostbyname_r [gethostbyname_r.c]
</EM><BR>
<P>This isn't caused by SANE?
<BR>
<P><EM>&gt; **** Purify instrumented /export/home/pere/gnu/bin/scanimage (pid 24128) ****
</EM><BR>
<EM>&gt; Purify: Searching for all memory leaks...
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; Memory leaked: 3413 bytes (32.3%); potentially leaked: 0 bytes (0%)
</EM><BR>
<P>[lots of leaks in sanei_wire]
<BR>
<P>Are these the leaks you fixed or are these additional ones?
<BR>
<P><EM>&gt; MLK: 24 bytes leaked in 3 blocks
</EM><BR>
<EM>&gt; * This memory was allocated from:
</EM><BR>
<EM>&gt; malloc [rtlib.o]
</EM><BR>
<EM>&gt; strndup [strndup.c:33]
</EM><BR>
<EM>&gt; sanei_config_get_string [sanei_config.c:169]
</EM><BR>
<EM>&gt; sanei_config_attach_matching_devices [sanei_config2.c:95]
</EM><BR>
<EM>&gt; sane_pie_init [pie.c:2937]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; * Block of 8 bytes (3 times); last block at 0x252fa0
</EM><BR>
<P>&quot;type&quot; isn't freed in sanei_config_attach_matching_devices.
<BR>
<P><EM>&gt; MLK: 20 bytes leaked at 0x2467a8
</EM><BR>
<EM>&gt; * This memory was allocated from:
</EM><BR>
<EM>&gt; malloc [rtlib.o]
</EM><BR>
<EM>&gt; attach [as6e.c:841]
</EM><BR>
<EM>&gt; sane_as6e_init [as6e.c:627]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<EM>&gt; sane_get_devices [dll-s.c:15]
</EM><BR>
<P>&quot;dev&quot; doesn't seem to be freed but i don't understand why.
<BR>
<P><EM>&gt; MLK: 5 bytes leaked in 5 blocks
</EM><BR>
<EM>&gt; * This memory was allocated from:
</EM><BR>
<EM>&gt; malloc [rtlib.o]
</EM><BR>
<EM>&gt; strndup [strndup.c:33]
</EM><BR>
<EM>&gt; sanei_config_get_string [sanei_config.c:169]
</EM><BR>
<EM>&gt; sane_mustek_init [mustek.c:4840]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<EM>&gt; * Block of 1 byte (5 times); last block at 0x2474a8
</EM><BR>
<P>&quot;word&quot; doesn't seem to be freed on some ocasions.
<BR>
<P><EM>&gt; MLK: 1 byte leaked at 0x24a480
</EM><BR>
<EM>&gt; * This memory was allocated from:
</EM><BR>
<EM>&gt; malloc [rtlib.o]
</EM><BR>
<EM>&gt; strndup [strndup.c:33]
</EM><BR>
<EM>&gt; sanei_config_get_string [sanei_config.c:169]
</EM><BR>
<EM>&gt; sane_avision_init [avision.c:1393]
</EM><BR>
<EM>&gt; init [dll.c:400]
</EM><BR>
<EM>&gt; sane_dll_get_devices [dll.c:663]
</EM><BR>
<P>Same here.
<BR>
<P>Bye,
<BR>
&nbsp;&nbsp;Henning
<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:%20scanimage%20-T%20using%20Purify...&In-Reply-To=&lt;20010429165603.A31678@vortex.swb.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0308.html">Petter Reinholdtsen: "Re: scanimage -T using Purify..."</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0306.html">John Buell: "Re: [discuss] SANE support"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0303.html">Petter Reinholdtsen: "scanimage -T using Purify..."</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0308.html">Petter Reinholdtsen: "Re: scanimage -T using Purify..."</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#307">[ date ]</A>
<A HREF="index.html#307">[ thread ]</A>
<A HREF="subject.html#307">[ subject ]</A>
<A HREF="author.html#307">[ 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>Sun Apr 29 2001 - 07:50:17 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>