Subject: | Memory handling problem |
Digest::MD5 reports a "Use of uninitialized value in subroutine entry at ..." error, which disappears if I change the memory footprint of the program (e.g. additional debug statements). I have noticed this a number of times, most recently with md5_hex(). The bug is consistent (happens every time), but not for all calls to md5_hex() (i.e. same location in the source everytime, but not necessarily other locations).
The patch supplied was suggested by Boris Zentner <boris@m2b.de> on perl-xml@listserv.activestate.com, which resolved the problem for him, although it did not work for me. Discussion on the Perl-XML mailing list suggests that the problem is with Digest::MD5.
My current environment is:
OS RH7.0 (2.4.5 kernel)
Perl 5.6.1
Apache 1.3.22
mod_perl 1.26
XML::LibXML 1.40
XML::LibXSLT 1.31
libxml2 2.4.11
libxslt 1.0.8
Digest::MD5 2.16
The problem came about when I upgraded from XML::LibXML 1.31 to 1.40, while Boris saw the problem under 1.31. I have seen a similar response with Digest::MD5 in the past, but it has generally disappeared during natural code evolution. Downgrading to v2.12 has fixed (or at least hidden) the problem.
I have contacted the authors of XML::LibXML with regard to this as well, and they are also looking into it. Experience suggests, however, that the problem may be with Digest::MD5.
HTH.
Ian
*** MD5.xs Fri Mar 15 15:09:13 2002
--- MD5.xs.patched Fri Mar 15 15:08:54 2002
***************
*** 53,58 ****
--- 53,67 ----
#define SvPVbyte SvPV
#endif
+ /* PATCH: Fri Mar 15 14:42:41 GMT 2002
+ * Boris Zentner <boris@m2b.de>
+ */
+ #undef SvPVbyte
+ #define SvPVbyte(sv, lp) \
+ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
+ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp))
+ /* END PATCH */
+
/* Perl does not guarantee that U32 is exactly 32 bits. Some system
* has no integral type with exactly 32 bits. For instance, A Cray has