From 91665eaa6361bbc939c5b41903061d0487fdf11b Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 10 Aug 2025 14:17:19 +0200 Subject: [PATCH] Backport Lexbor changes to 8.4 --- ext/dom/lexbor/lexbor/core/in.c | 2 +- ext/dom/lexbor/lexbor/core/str.c | 4 ++++ ext/dom/lexbor/lexbor/dom/interfaces/node.c | 5 ----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/dom/lexbor/lexbor/core/in.c b/ext/dom/lexbor/lexbor/core/in.c index 9214e198950..951e585cbd3 100644 --- a/ext/dom/lexbor/lexbor/core/in.c +++ b/ext/dom/lexbor/lexbor/core/in.c @@ -65,7 +65,7 @@ lexbor_in_node_make(lexbor_in_t *incoming, lexbor_in_node_t *last_node, node->opt = LEXBOR_IN_OPT_UNDEF; node->begin = buf; - node->end = buf + buf_size; + node->end = buf ? (buf + buf_size) : NULL; node->use = buf; if (last_node != NULL) { diff --git a/ext/dom/lexbor/lexbor/core/str.c b/ext/dom/lexbor/lexbor/core/str.c index 0f04286bdea..d11a08614dd 100644 --- a/ext/dom/lexbor/lexbor/core/str.c +++ b/ext/dom/lexbor/lexbor/core/str.c @@ -133,6 +133,10 @@ lexbor_str_append(lexbor_str_t *str, lexbor_mraw_t *mraw, { lxb_char_t *data_begin; + if (length == 0) { + return str->data; + } + lexbor_str_check_size_arg_m(str, lexbor_str_size(str), mraw, (length + 1), NULL); diff --git a/ext/dom/lexbor/lexbor/dom/interfaces/node.c b/ext/dom/lexbor/lexbor/dom/interfaces/node.c index 934b3508582..5a582059071 100644 --- a/ext/dom/lexbor/lexbor/dom/interfaces/node.c +++ b/ext/dom/lexbor/lexbor/dom/interfaces/node.c @@ -248,11 +248,6 @@ lxb_dom_node_t * lxb_dom_node_destroy(lxb_dom_node_t *node) { lxb_dom_node_remove(node); - - if (node->owner_document->ev_destroy != NULL) { - node->owner_document->ev_destroy(node); - } - return lxb_dom_document_destroy_interface(node); }