Skip to content
Closed
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
9 changes: 9 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ PHP NEWS
. Merge patches lexbor/lexbor@8a14bc0 and lexbor/lexbor@f67ce4b, fixing a
heap buffer overflow in :lexbor-contains() parsing and buffer overflows
in malformed decode replay. (alexandre-daubois)
. Merge patches lexbor/lexbor@859f100, lexbor/lexbor@a36e09a,
lexbor/lexbor@b0f7412, lexbor/lexbor@1b215a8, lexbor/lexbor@385afff,
lexbor/lexbor@e6c068f, lexbor/lexbor@327a8b6, lexbor/lexbor@917742f and
lexbor/lexbor@e89c258, fixing dropped usernames containing an at sign,
uninitialized memory in IDNA buffer growth, the encoding of a space
before a query or fragment in an opaque path, a query or fragment lost
after a dot segment in a path, replacement file drive paths, the output
encoding used for percent-encoding, the URLSearchParams tail pointer and
fragment serialization without a query. (alexandre-daubois)

- MBString:
. Fixed bug GH-23106 (mb_strpos() reads past the end of a haystack ending in
Expand Down
28 changes: 19 additions & 9 deletions ext/lexbor/lexbor/unicode/idna.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ lxb_unicode_idna_realloc(lxb_codepoint_t *buf, const lxb_codepoint_t *buffer,
lxb_codepoint_t *tmp;

nlen = ((*buf_end - buf) * 4) + len;

if (buf == buffer) {
tmp = lexbor_malloc(nlen * sizeof(lxb_codepoint_t));
if (tmp == NULL) {
return NULL;
}

memcpy(tmp, buf, (*buf_p - buf) * sizeof(lxb_codepoint_t));
}
else {
tmp = lexbor_realloc(buf, nlen * sizeof(lxb_codepoint_t));
Expand Down Expand Up @@ -458,13 +460,17 @@ lxb_unicode_idna_ascii_puny_cb(const lxb_char_t *data, size_t length, void *ctx,

if (asc->buf == asc->buffer) {
tmp = lexbor_malloc(nlen);
if (tmp == NULL) {
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
}

memcpy(tmp, asc->buf, asc->p - asc->buf);
}
else {
tmp = lexbor_realloc(asc->buf, nlen);
}

if (tmp == NULL) {
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
if (tmp == NULL) {
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
}
}

asc->p = tmp + (asc->p - asc->buf);
Expand Down Expand Up @@ -711,13 +717,17 @@ lxb_unicode_idna_to_unicode_cb(const lxb_codepoint_t *part, size_t len,

if (asc->buf == asc->buffer) {
tmp = lexbor_malloc(nlen);
if (tmp == NULL) {
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
}

memcpy(tmp, asc->buf, asc->p - asc->buf);
}
else {
tmp = lexbor_realloc(asc->buf, nlen);
}

if (tmp == NULL) {
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
if (tmp == NULL) {
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
}
}

asc->p = tmp + (asc->p - asc->buf);
Expand Down
Loading
Loading