GNOME Bugzilla – Bug 69625
xmlDocDumpMemory Crashes with various memory access errors.
Last modified: 2009-08-15 18:40:50 UTC
Windows NT 4sp3 libxml2 version 2.4.13 MSVC++ 5.0 Compiled with the Debug Configuration: Parse the following instance with xmlParseFile then dump with xmlDocDumpMemory: <?xml version="1.0" ?> <PIBX> <PIB name="Me"> <ACCOUNT name="monster.com"> <LoginUrl>http://my.monster.ca/login.asp</LoginUrl> <UserName>flysolo99</UserName> <Password>bigsecret</Password> </ACCOUNT> </PIB> </PIBX> No libxml2 code was changed except xmlwin32version.h which is set up as follows: #if 0 #define WITH_TRIO #else #define WITHOUT_TRIO #endif #if 0 #define LIBXML_THREAD_ENABLED #endif #if 0 #define LIBXML_FTP_ENABLED #endif #if 0 #define LIBXML_HTTP_ENABLED #endif #if 1 #define LIBXML_HTML_ENABLED #endif #if 0 #define LIBXML_CATALOG_ENABLED #endif #if 0 #define LIBXML_DOCB_ENABLED #endif #if 0 #define LIBXML_XPATH_ENABLED #endif #if 0 #define LIBXML_XPTR_ENABLED #endif #if 0 #define LIBXML_XINCLUDE_ENABLED #endif #if 0 #define LIBXML_ICONV_ENABLED #endif #if 1 #define LIBXML_DEBUG_ENABLED #endif #if 1 #define DEBUG_MEMORY_LOCATION #endif
It crashes with xmlDocDump too.
I can't reproduce it on Linux: orchis:~/XML -> ./xmllint --memory tst.xml <?xml version="1.0"?> <PIBX> <PIB name="Me"> <ACCOUNT name="monster.com"> <LoginUrl>http://my.monster.ca/login.asp</LoginUrl> <UserName>flysolo99</UserName> <Password>bigsecret</Password> </ACCOUNT> </PIB> </PIBX> orchis:~/XML -> ./xmllint tst.xml <?xml version="1.0"?> <PIBX> <PIB name="Me"> <ACCOUNT name="monster.com"> <LoginUrl>http://my.monster.ca/login.asp</LoginUrl> <UserName>flysolo99</UserName> <Password>bigsecret</Password> </ACCOUNT> </PIB> </PIBX> orchis:~/XML -> Does the xmllint test fails on your setup ? - if no the bug is in your code - if yes contact the maintainer of the Windows port Igor on the list, there is nothing I can do about it Daniel
It is probably related to the use of the memory debug wrapper #if 1 #define LIBXML_DEBUG_ENABLED #endif #if 1 #define DEBUG_MEMORY_LOCATION #endif Try switching them off, I have no idea if this may work with Windows or DLL. Again the best to get help on Windows specific issues is join the list and ask there. Daniel
-xmllint doesn't build cleanly and I don't have time now to figure out why. How could there be a bug in my code: xmlDocPtr docptr; docptr = xmlParseFile("test.pibx"); if (docptr == NULL) return 0; printf("got here!\n"); xmlDocDump( stdout, docptr); My XML instance is so small it is also obviously valid by visual inspection. I'm pressed for time so my plan of attack is to write my own instance specific serializer since the in memory representation of my instance seems valid. I tried it with with the memory debug wrapper both on and off with the same result. I may join the windows list later when I have more time.
I bet your code is correct, that it would crash with any XML instance, and thus that the problem lies somewhere else which I have no way to debug since it's tied to your platform which I don't and can't support directly ! Igor is the person doing the Windows build. I don't want to debug them, I have no way to do this. Use his binary, check if there is the same error, if not blame your vompilation environment, if yes send him or the list a report. Daniel
No more input, I think this is closed. Daniel