From 837ced350c5123c21c32154f1f2dc483238f7629 Mon Sep 17 00:00:00 2001 From: mloy Date: Thu, 30 Oct 2014 14:30:05 +0100 Subject: load_buffer_impl always checks if buffer is valid pointer and size > 0 added some tests to force invalid buffer and size = 0 --- src/pugixml.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index b39aad0..47aba28 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4292,7 +4292,12 @@ PUGI__NS_BEGIN PUGI__FN xml_parse_result load_buffer_impl(xml_document_struct* doc, xml_node_struct* root, void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own, char_t** out_buffer) { // check input buffer - assert(contents || size == 0); + if ((contents==NULL) && (size!=0)) { + xml_parse_result result; + result.status = status_no_document_element; + return result; + } + // get actual encoding xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); -- cgit v1.2.3