Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SAX2 parser for GML/KML #758

Closed
wants to merge 2 commits into from
Closed

Conversation

pramsey
Copy link
Member

@pramsey pramsey commented Jan 27, 2024

This works around a change in the SAX1 parser behaviour that came about recently in RHEL builds due to a security fix that has been widely applied.

https://gitlab.gnome.org/GNOME/libxml2/-/issues/535
https://access.redhat.com/errata/RHSA-2024:0119

Comment on lines +129 to +130
char *colon_pos;
char *node_name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
char *colon_pos;
char *node_name;
const char *colon_pos;
const char *node_name;

/* If there's a colon in the element name, */
/* move past it before checking for equality with */
/* the element name we are looking for */
node_name = (char*)xn->name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node_name = (char*)xn->name;
node_name = (const char*)xn->name;

Comment on lines +70 to +71
char *colon_pos;
char *node_name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
char *colon_pos;
char *node_name;
const char *colon_pos;
const char *node_name;

/* If there's a colon in the element name, */
/* move past it before checking for equality with */
/* the element name we are looking for */
node_name = (char*)xn->name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node_name = (char*)xn->name;
node_name = (const char*)xn->name;

@@ -88,7 +110,8 @@ Datum geom_from_kml(PG_FUNCTION_ARGS)

/* Begin to Parse XML doc */
xmlInitParser();
xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, XML_PARSE_SAX1);
xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, 0);
// xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, XML_PARSE_SAX1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, XML_PARSE_SAX1);

static inline bool
is_xml_element(xmlNodePtr xn, const char *xml_name)
{
char *colon_pos, *node_name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
char *colon_pos, *node_name;
const char *colon_pos;
const char *node_name;

/* If there's a colon in the element name, */
/* move past it before checking for equality with */
/* the element name we are looking for */
node_name = (char*)xn->name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node_name = (char*)xn->name;
node_name = (const char*)xn->name;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! Applied in 7038255 going forwards.

@pramsey pramsey closed this Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants