[ expat-Bugs-1064174 ] XML_GetBuffer / ParseBuffer bug
"SourceForge.net" <[email protected]>
| Newsgroups | gmane.text.xml.expat.bugs |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1064174, was opened at 2004-11-10 23:20 Message generated for change (Comment added) made by wernight You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1064174&group_id=10127 Category: None Group: None Status: Open Resolution: Rejected Priority: 5 Submitted By: Werner BEROUX (wernight) Assigned to: Nobody/Anonymous (nobody) Summary: XML_GetBuffer / ParseBuffer bug Initial Comment: I saw the bug by a little different code than the one under but this one bug and can be checked really fast. I do: Assigne EnableStartElementHandler, EnableEndElementHandler, EnableCharacterDataHandler(). XML_ParserCreate_MM(NULL, NULL, NULL); XML_GetBuffer(257); int nLength = file.Read(pszBuffer, 256); pszBuffer[nLength] = '\0'; // Don't forget this. XML_ParseBuffer(nLength, nLength < 257); // Returns false. Note that when I set buffer to 512 it works. I'm calling the XML_GetBuffer() each time in the loop and normally I don't put a closing '\0'. Configuration: - I'm using CExpatImpl from CodeProject. Which is only a wrapper. - eXpat 1.95.8 with XML_UNICODE_WCHAR_T and XML_STATIC defined. - PC AMD64 - WinXP ---------------------------------------------------------------------- >Comment By: Werner BEROUX (wernight) Date: 2004-11-11 13:08 Message: Logged In: YES user_id=298482 Look back and you'll see that I've inserted the '\0' at character 256 and I'm asking XML_ParseBuffer() tu parse only up to 255. I discovered the bug by not using the end '\0' the problem was then only visible in the interpretation of the datas where I got too much calls to OnCharsData (something like this). ---------------------------------------------------------------------- Comment By: Karl Waclawek (kwaclaw) Date: 2004-11-10 23:40 Message: Logged In: YES user_id=290026 It is wrong to append null to the end of the buffer. this inserts an invalid character in the document. Leave it out and try again. It should work. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1064174&group_id=10127