From afb627fbc26ea3379ee89f90d1198a7126bd4aac Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 4 Jan 2020 11:08:11 +0100 Subject: [PATCH] xmlparse.cpp skip memmove if pool->start (src) is 0 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/edcde861bca5ecf561a173c4dd1e5e6fb4a2498a Author: Jacek Jendrzej Date: 2020-01-04 (Sat, 04 Jan 2020) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/xmltree/xmlparse.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/xmltree/xmlparse.cpp b/lib/xmltree/xmlparse.cpp index 8da590cbe..26608c884 100644 --- a/lib/xmltree/xmlparse.cpp +++ b/lib/xmltree/xmlparse.cpp @@ -854,7 +854,7 @@ enum XML_Error XML_Parser::doContent(int startTagLevel, const ENCODING *enc, con if (result) return result; }; - // fall through */ + // fall through case XML_TOK_EMPTY_ELEMENT_NO_ATTS: if (startElementHandler || endElementHandler) @@ -2691,7 +2691,8 @@ static int poolGrow(STRING_POOL *pool) pool->blocks=pool->freeBlocks; pool->freeBlocks=tem; - memmove(pool->blocks->s, pool->start, (pool->end-pool->start)*sizeof(XML_Char)); + if (pool->start) + memmove(pool->blocks->s, pool->start, (pool->end-pool->start)*sizeof(XML_Char)); pool->ptr=pool->blocks->s+(pool->ptr-pool->start); pool->start=pool->blocks->s; @@ -2733,7 +2734,8 @@ static int poolGrow(STRING_POOL *pool) pool->blocks=tem; - memmove(tem->s, pool->start, (pool->ptr-pool->start)*sizeof(XML_Char)); //FIXME: pool->start seems to be a null pointer in some constellations, eg. with disabled pugixml, memmove don't like NULL-pointer for parameter 2 + if (pool->start) + memmove(tem->s, pool->start, (pool->ptr-pool->start)*sizeof(XML_Char)); pool->ptr=tem->s+(pool->ptr-pool->start); pool->start=tem->s;