[php-src] PR #25840: Adjust local_name_length when stripping prefix in HTML5 attribute parser
| From: | hohphu8 | Date: | Fri, 27 Nov 2026 14:40:30 +0000 |
| Subject: | [php-src] PR #25840: Adjust local_name_length when stripping prefix in HTML5 attribute parser | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41119@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25840
Author: hohphu8
In
lexbor_libxml2_bridge_convert() (ext/dom/html5_parser.c), when
converting a prefixed foreign HTML5 attribute (attr->node.prefix set, e.g.
xlink:href or xml:lang), local_name is advanced past the
':' separator without reducing local_name_length by the skipped
prefix length. The unadjusted local_name_length is then passed to
xmlDictLookup(doc->dict, local_name, local_name_length), causing it to read past the
end of the local name string (up to a few bytes past u.short_str inside
lxb_dom_attr_data_t).
This subtracts the skipped byte count (pos + 1 - local_name) from
local_name_length alongside advancing local_name.
Verified clean build and ext/dom/tests/modern/ passing on PHP-8.4 (Debug +
ZTS) and master (ASan+UBSan). No userland-visible failure has been observed; the issue
was identified through source inspection.