Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ext/lexbor/config.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
PHP_LEXBOR_CFLAGS="-Wno-unknown-warning-option -Wno-unterminated-string-initialization -I@ext_srcdir@/"

if test "$PHP_ADDRESS_SANITIZER" = "yes"; then
PHP_LEXBOR_CFLAGS="$PHP_LEXBOR_CFLAGS -DLEXBOR_HAVE_ADDRESS_SANITIZER=1"
else
case "$CFLAGS" in
*-fsanitize=address*|\
*-fsanitize=*,address*)
PHP_LEXBOR_CFLAGS="$PHP_LEXBOR_CFLAGS -DLEXBOR_HAVE_ADDRESS_SANITIZER=1"
;;
esac
fi

LEXBOR_DIR="lexbor"

AC_DEFINE([HAVE_LEXBOR], [1], [Define to 1 if the PHP extension 'lexbor' is available.])
Expand Down
4 changes: 4 additions & 0 deletions ext/lexbor/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ ADD_SOURCES("ext/lexbor/lexbor/unicode", "idna.c unicode.c","lexbor");
ADD_SOURCES("ext/lexbor/lexbor/url", "url.c","lexbor");
ADD_FLAG("CFLAGS_LEXBOR", "/D LEXBOR_BUILDING /utf-8");

if (PHP_SANITIZER == "yes") {
ADD_FLAG("CFLAGS_LEXBOR", "/D LEXBOR_HAVE_ADDRESS_SANITIZER=1");
}

AC_DEFINE("HAVE_LEXBOR", 1, "Define to 1 if the PHP extension 'lexbor' is available.");

PHP_INSTALL_HEADERS("ext/lexbor", "php_lexbor.h lexbor/");
3 changes: 0 additions & 3 deletions ext/lexbor/lexbor/url/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -3443,9 +3443,6 @@ lxb_url_host_parse(lxb_url_parser_t *parser, const lxb_char_t *data,

if (lxb_url_is_ipv4(parser, domain->data, end)) {
status = lxb_url_ipv4_parse(parser, domain->data, end, &ipv4);

(void) lexbor_str_destroy(domain, mraw, false);

@kocsismate kocsismate Jul 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lexbor_str_destroy() call frees and subsequently poisons the domain string's memory region, but the character where parsing failed is added to the logs, causing a use-after-poison error during returing the error in fill_errors().

Since lexbor uses an arena allocator, skipping the explicit lexbor_str_destroy() call should not cause a memory leak (but correct me if I'm wrong) — the memory will be reclaimed at the end of the request.


if (status != LXB_STATUS_OK) {
return status;
}
Expand Down