From 13bb381d296ef8da09a3f00f5b23724b5deb6a38 Mon Sep 17 00:00:00 2001w From: Sebastian Pipping Date: Wed, 27 May 2020 20:28:06 +0200 Subject: [PATCH] xmlparse.c: Fix reading uninitialized variable (#404) --- Changes | 3 +++ lib/xmlparse.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index a642bf6..72c1f13 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,7 @@ Release 2.2.9 Wed Septemper 25 2019 Bug fixes: #390 #395 Fix undefined behavior during parsing when compiled with -DXML_UNICODE that was introduced with Expat 2.0.1 + #404 Fix reading uninitialized variable during parsing New features: #34 #466 #484 Add two new API functions to further tighten billion laughs @@ -55,6 +56,8 @@ Release 2.2.9 Wed Septemper 25 2019 Clang LeakSan JetBrains OSS-Fuzz + and + Cppcheck 2.0 and the Cppcheck team Release 2.2.8 Fri Septemper 13 2019 Security fixes: diff --git a/lib/xmlparse.c b/lib/xmlparse.c index f2ad416..03da172 100644 --- a/lib/xmlparse.c +++ b/lib/xmlparse.c @@ -3732,7 +3732,7 @@ doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, *startPtr = NULL; for (;;) { - const char *next; + const char *next = s; /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */ int tok = XmlCdataSectionTok(enc, s, end, &next); #ifdef XML_DTD if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) { @@ -3858,7 +3858,7 @@ ignoreSectionProcessor(XML_Parser parser, const char *start, const char *end, static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore) { - const char *next; + const char *next = *startPtr; /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */ int tok; const char *s = *startPtr; const char **eventPP; -- 1.8.3.1