mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
io: Fix memory lifetime issue with input buffers
xmlParserInputBufferCreateMem must make a copy of the buffer. This fixes a regression from 2.11 which could cause reads from freed memory depending on the use case. Undeprecate xmlParserInputBufferCreateStatic which can avoid copying the whole buffer.
This commit is contained in:
@@ -6719,7 +6719,8 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size,
|
||||
|
||||
htmlCtxtReset(ctxt);
|
||||
|
||||
input = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
|
||||
input = xmlParserInputBufferCreateStatic(buffer, size,
|
||||
XML_CHAR_ENCODING_NONE);
|
||||
if (input == NULL) {
|
||||
htmlErrMemory(ctxt, NULL);
|
||||
return(NULL);
|
||||
|
||||
Reference in New Issue
Block a user