Ticket Hash: | 73b0bbd85ece37d314b1af0e67c67002769fcbd4 | |||
Title: | removeAttributeNS: segmentation fault when there are other attributes with no namespace | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Important | Priority: | Immediate | |
Subsystem: | Resolution: | Fixed | ||
Last Modified: | 2017-06-17 01:09:49 | |||
Version Found In: | head | |||
User Comments: | ||||
anonymous added on 2017-06-16 10:45:23:
(text/x-fossil-wiki)
When <code>removeAttributeNS()</code> is called, if the node contains other attributes having no explicit namespace, there is a segmentation fault at <code>dom.c/domRemoveAttributeNS</code>, which in line 3243 assumes the existence of a namespace. Here is a patch: <code><verbatim> --- generic/dom.c +++ generic/dom.c @@ -3238,11 +3238,11 @@ attr = node->firstAttr; while (attr) { domSplitQName (attr->nodeName, prefix, &str); if (strcmp(localName,str)==0) { ns = domGetNamespaceByIndex(node->ownerDocument, attr->namespace); - if (strcmp(ns->uri, uri)==0) { + if (ns && strcmp(ns->uri, uri)==0) { if (previous) { previous->nextSibling = attr->nextSibling; } else { attr->parentNode->firstAttr = attr->nextSibling; } </verbatim></code> rolf added on 2017-06-17 01:09:49: (text/x-fossil-plain) Yes. Applied your fix. Thanks. |