Skip to content
Snippets Groups Projects
Commit d2d52bbb authored by Tom Lane's avatar Tom Lane
Browse files

xmlGetUTF8Char()'s second argument is both input and output. Fix

uninitialized value, and avoid invoking the function nine separate
times in the pg_xmlIsNameChar macro.  Should resolve buildfarm failures.
Per report from Ben Leslie.
parent 58ac0f92
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.54 2007/11/09 15:52:51 petere Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.55 2007/11/10 18:51:20 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -998,7 +998,8 @@ xml_init(void) ...@@ -998,7 +998,8 @@ xml_init(void)
while (xmlIsBlank_ch(*(p))) (p)++ while (xmlIsBlank_ch(*(p))) (p)++
/* Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender */ /* Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender */
#define pg_xmlIsNameChar(c) \ /* Beware of multiple evaluations of argument! */
#define PG_XMLISNAMECHAR(c) \
(xmlIsBaseChar_ch(c) || xmlIsIdeographicQ(c) \ (xmlIsBaseChar_ch(c) || xmlIsIdeographicQ(c) \
|| xmlIsDigit_ch(c) \ || xmlIsDigit_ch(c) \
|| c == '.' || c == '-' || c == '_' || c == ':' \ || c == '.' || c == '-' || c == '_' || c == ':' \
...@@ -1012,6 +1013,7 @@ parse_xml_decl(const xmlChar *str,size_t *lenp, ...@@ -1012,6 +1013,7 @@ parse_xml_decl(const xmlChar *str,size_t *lenp,
const xmlChar *p; const xmlChar *p;
const xmlChar *save_p; const xmlChar *save_p;
size_t len; size_t len;
int utf8char;
int utf8len; int utf8len;
xml_init(); xml_init();
...@@ -1028,8 +1030,10 @@ parse_xml_decl(const xmlChar *str,size_t *lenp, ...@@ -1028,8 +1030,10 @@ parse_xml_decl(const xmlChar *str,size_t *lenp,
if (xmlStrncmp(p, (xmlChar *)"<?xml", 5) != 0) if (xmlStrncmp(p, (xmlChar *)"<?xml", 5) != 0)
goto finished; goto finished;
/* This means it's a PI like <?xml-stylesheet ...?>. */ /* if next char is name char, it's a PI like <?xml-stylesheet ...?> */
if (pg_xmlIsNameChar(xmlGetUTF8Char(&p[5], &utf8len))) utf8len = strlen((const char *) (p+5));
utf8char = xmlGetUTF8Char(p+5, &utf8len);
if (PG_XMLISNAMECHAR(utf8char))
goto finished; goto finished;
p += 5; p += 5;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment