Skip to content

Commit 20520eb

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix GH-25306: Assertion status == LXB_STATUS_OK in dom_parse_selector when lexbor allocation fails
2 parents 24934c9 + e4f0450 commit 20520eb

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎NEWS‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ PHP NEWS
3131
. Fixed dba_close() not closing a database opened with dba_popen().
3232
(Ilia Alshanetsky)
3333

34+
- DOM:
35+
. Fixed bug GH-25306 (Assertion status == LXB_STATUS_OK in dom_parse_selector
36+
when lexbor allocation fails). (ndossche)
37+
3438
- MBString:
3539
. Fixed stack overflow in mb_check_encoding() and mb_convert_encoding() with
3640
deeply nested arrays. (Eyüp Can Akman)

‎ext/dom/parentnode/css_selectors.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,15 @@ static lxb_css_selector_list_t *dom_parse_selector(
8484

8585
memset(parser, 0, sizeof(lxb_css_parser_t));
8686
status = lxb_css_parser_init(parser, NULL);
87-
ZEND_ASSERT(status == LXB_STATUS_OK);
87+
if (UNEXPECTED(status != LXB_STATUS_OK)) {
88+
return NULL;
89+
}
8890

8991
memset(selectors, 0, sizeof(lxb_selectors_t));
9092
status = lxb_selectors_init(selectors);
91-
ZEND_ASSERT(status == LXB_STATUS_OK);
93+
if (UNEXPECTED(status != LXB_STATUS_OK)) {
94+
return NULL;
95+
}
9296
lxb_selectors_opt_set(selectors, dom_quirks_opt(options, intern));
9397

9498
lxb_css_selector_list_t *list = lxb_css_selectors_parse(parser, (const lxb_char_t *) ZSTR_VAL(selectors_str), ZSTR_LEN(selectors_str));

0 commit comments

Comments
 (0)