Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87cba40

Browse files
committed
Some time ago John Gray <jgray@azuli.co.uk> and myself worked out and
tested a patch to contrib/xml where the existing code was causingpostgres to crash when it encountered & entities in the XML. I'veenclosed a patch that John came up with to correct this problem. Itpatches against 7.3 and will apply on 7.2x if the elog WARNING callsare changed to elog NOTICE.Michael Richards
1 parent5b4c16e commit87cba40

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎contrib/xml/pgxml_dom.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ pgxml_parse(PG_FUNCTION_ARGS)
8787
doctree=xmlParseMemory((char*)VARDATA(t),docsize);
8888
if (doctree==NULL)
8989
{
90-
/* xmlCleanupParser(); */
90+
xmlCleanupParser();
9191
PG_RETURN_BOOL(false);/* i.e. not well-formed */
9292
}
93-
/*xmlCleanupParser();*/
93+
xmlCleanupParser();
9494
xmlFreeDoc(doctree);
9595
PG_RETURN_BOOL(true);
9696
}
@@ -202,7 +202,8 @@ pgxml_xpath(PG_FUNCTION_ARGS)
202202

203203
doctree=xmlParseMemory((char*)VARDATA(t),docsize);
204204
if (doctree==NULL)
205-
{/* not well-formed */
205+
{/* not well-formed */
206+
xmlCleanupParser();
206207
PG_RETURN_NULL();
207208
}
208209

@@ -216,6 +217,7 @@ pgxml_xpath(PG_FUNCTION_ARGS)
216217
elog(WARNING,"XPath syntax error");
217218
xmlFreeDoc(doctree);
218219
pfree((void*)xpath);
220+
xmlCleanupParser();
219221
PG_RETURN_NULL();
220222
}
221223

@@ -227,6 +229,7 @@ pgxml_xpath(PG_FUNCTION_ARGS)
227229
{
228230
xmlFreeDoc(doctree);
229231
pfree((void*)xpath);
232+
xmlCleanupParser();
230233
PG_RETURN_NULL();/* seems appropriate */
231234
}
232235
/* now we dump this node, ?surrounding by tags? */
@@ -257,6 +260,6 @@ pgxml_xpath(PG_FUNCTION_ARGS)
257260
xmlFreeDoc(doctree);
258261
pfree((void*)xpath);
259262
xmlFree(xpresstr);
260-
263+
xmlCleanupParser();
261264
PG_RETURN_TEXT_P(xpres);
262265
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp