From: Dmitry Volyntsev Date: Tue, 22 Sep 2026 04:03:48 +0000 (-0700) Subject: XML: guard against content allocation failure X-Git-Tag: 1.0.2~15 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=16f6a5b16d2bcf3ebbeed72ea4b949416c64289f;p=njs.git XML: guard against content allocation failure Report a memory error when libxml cannot allocate node content instead of passing a NULL pointer to the string conversion path. --- diff --git a/external/njs_xml_module.c b/external/njs_xml_module.c index 08979bec..e745a5d6 100644 --- a/external/njs_xml_module.c +++ b/external/njs_xml_module.c @@ -988,6 +988,11 @@ njs_xml_node_ext_text(njs_vm_t *vm, njs_object_prop_t *unused, uint32_t unused1, if (retval != NULL && setval == NULL) { content.start = xmlNodeGetContent(current); + if (njs_slow_path(content.start == NULL)) { + njs_vm_memory_error(vm); + return NJS_ERROR; + } + ret = njs_vm_value_string_create(vm, retval, content.start, njs_strlen(content.start));