[xml] Valgrind problems with xmlParseFile



We are calling
xmlParseFile("constantfilename.xml")
and this is producing Valgrind errors.

On inspection, it appears to be coming from the code snippet below,
almost certainly the gzdirect call (though the name is lost from
the stack trace).

Other people have seen this outside libxml and it is probably a zlib
issue. However, we KNOW our file is not compressed. Is there a way
that we can do an xmlParseFile and say "please don't even try to
use a compression handler"?

--
Alex Bligh

#ifdef HAVE_ZLIB_H
       if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) &&
               (strcmp(URI, "-") != 0)) {
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230
           ret->compressed = !gzdirect(context);
#else
           if (((z_stream *)context)->avail_in > 4) {
               char *cptr, buff4[4];
               cptr = (char *) ((z_stream *)context)->next_in;
               if (gzread(context, buff4, 4) == 4) {
                   if (strncmp(buff4, cptr, 4) == 0)
                       ret->compressed = 0;
                   else
                       ret->compressed = 1;
                   gzrewind(context);
               }
           }
#endif



==28184== Conditional jump or move depends on uninitialised value(s)
==28184== at 0x62594E0: inflateReset2 (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4) ==28184== by 0x62595D8: inflateInit2_ (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==28184==    by 0x6253323: ??? (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==28184== by 0x4E91675: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E91DA1: __xmlParserInputBufferCreateFilename (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E67281: xmlNewInputFromFile (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E7A8C5: xmlCreateURLParserCtxt (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E80255: xmlSAXParseFileWithData (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8)
==28184==    by 0x41529B: getXMLInfo (xvpagent.c:222)
==28184==    by 0x415B30: main (xvpagent.c:475)
==28184==  Uninitialised value was created by a heap allocation
==28184== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==28184== by 0x62595B6: inflateInit2_ (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==28184==    by 0x6253323: ??? (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==28184== by 0x4E91675: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E91DA1: __xmlParserInputBufferCreateFilename (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E67281: xmlNewInputFromFile (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E7A8C5: xmlCreateURLParserCtxt (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8) ==28184== by 0x4E80255: xmlSAXParseFileWithData (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8)
==28184==    by 0x41529B: getXMLInfo (xvpagent.c:222)
==28184==    by 0x415B30: main (xvpagent.c:475)






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]