mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-27 19:10:20 +01:00 
			
		
		
		
	XML: fixed an issue with parsing a memory buffer > 2 GB
This commit is contained in:
		| @@ -265,7 +265,15 @@ void ParserEngine::parse(const char* pBuffer, std::size_t size) | ||||
| 	pushContext(_parser, &src); | ||||
| 	if (_pContentHandler) _pContentHandler->setDocumentLocator(this); | ||||
| 	if (_pContentHandler) _pContentHandler->startDocument(); | ||||
| 	if (!XML_Parse(_parser, pBuffer, static_cast<int>(size), 1)) | ||||
| 	std::size_t processed = 0; | ||||
| 	while (processed < size) | ||||
| 	{ | ||||
| 		const int bufferSize = processed + PARSE_BUFFER_SIZE < size ? PARSE_BUFFER_SIZE : size - processed; | ||||
| 		if (!XML_Parse(_parser, pBuffer + processed, bufferSize, 0)) | ||||
| 			handleError(XML_GetErrorCode(_parser)); | ||||
| 		processed += bufferSize; | ||||
| 	} | ||||
| 	if (!XML_Parse(_parser, pBuffer+processed, 0, 1)) | ||||
| 		handleError(XML_GetErrorCode(_parser)); | ||||
| 	if (_pContentHandler) _pContentHandler->endDocument(); | ||||
| 	popContext(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Guenter Obiltschnig
					Guenter Obiltschnig