Skip to content

Commit 0cd59c9

Browse files
iluuu1994DanielEScherzer
authored andcommitted
Merge Lexbor patch c3a68477399d446660ac241d3a55357dc95c6e81
(cherry picked from commit 2587b82)
1 parent 13f0993 commit 0cd59c9

9 files changed

Lines changed: 46 additions & 8 deletions

ext/lexbor/lexbor/url/url.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ lxb_url_scheme_length = sizeof(lxb_url_scheme_res) / sizeof(lxb_url_scheme_data_
499499
if (tmp == NULL) { \
500500
return NULL; \
501501
} \
502+
memcpy(tmp, (sbuf_begin), offset); \
502503
} \
503504
else { \
504505
tmp = lexbor_realloc((sbuf_begin), new_len); \
@@ -509,7 +510,7 @@ lxb_url_scheme_length = sizeof(lxb_url_scheme_res) / sizeof(lxb_url_scheme_data_
509510
} \
510511
\
511512
(sbuf) = tmp + offset; \
512-
(last) = sbuf + lst; \
513+
(last) = tmp + lst; \
513514
(sbuf_begin) = tmp; \
514515
(sbuf_end) = tmp + new_len; \
515516
} \

ext/lexbor/patches/0001-Expose-line-and-column-information-for-use-in-PHP.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
33
Date: Sat, 26 Aug 2023 15:08:59 +0200
4-
Subject: [PATCH 1/7] Expose line and column information for use in PHP
4+
Subject: [PATCH 1/8] Expose line and column information for use in PHP
55

66
---
77
source/lexbor/dom/interfaces/node.h | 2 ++

ext/lexbor/patches/0002-Track-implied-added-nodes-for-options-use-in-PHP.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
33
Date: Mon, 14 Aug 2023 20:18:51 +0200
4-
Subject: [PATCH 2/7] Track implied added nodes for options use in PHP
4+
Subject: [PATCH 2/8] Track implied added nodes for options use in PHP
55

66
---
77
source/lexbor/html/tree.h | 3 +++

ext/lexbor/patches/0003-Patch-utilities-and-data-structure-to-be-able-to-gen.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
33
Date: Thu, 24 Aug 2023 22:57:48 +0200
4-
Subject: [PATCH 3/7] Patch utilities and data structure to be able to generate
4+
Subject: [PATCH 3/8] Patch utilities and data structure to be able to generate
55
smaller lookup tables
66

77
Changed the generation script to check if everything fits in 32-bits.

ext/lexbor/patches/0004-Remove-unused-upper-case-tag-static-data.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
33
Date: Wed, 29 Nov 2023 21:26:47 +0100
4-
Subject: [PATCH 4/7] Remove unused upper case tag static data
4+
Subject: [PATCH 4/8] Remove unused upper case tag static data
55

66
---
77
source/lexbor/tag/res.h | 2 ++

ext/lexbor/patches/0005-Shrink-size-of-static-binary-search-tree.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
33
Date: Wed, 29 Nov 2023 21:29:31 +0100
4-
Subject: [PATCH 5/7] Shrink size of static binary search tree
4+
Subject: [PATCH 5/8] Shrink size of static binary search tree
55

66
This also makes it more efficient on the data cache.
77
---

ext/lexbor/patches/0006-Patch-out-unused-CSS-style-code.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
33
Date: Sun, 7 Jan 2024 21:59:28 +0100
4-
Subject: [PATCH 6/7] Patch out unused CSS style code
4+
Subject: [PATCH 6/8] Patch out unused CSS style code
55

66
---
77
source/lexbor/css/rule.h | 2 ++

ext/lexbor/patches/0007-URL-fixed-setters-for-empty-hosts.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Alexander Borisov <lex.borisov@gmail.com>
33
Date: Fri, 26 Jun 2026 18:55:56 +0300
4-
Subject: [PATCH 7/7] URL: fixed setters for empty hosts.
4+
Subject: [PATCH 7/8] URL: fixed setters for empty hosts.
55
MIME-Version: 1.0
66
Content-Type: text/plain; charset=UTF-8
77
Content-Transfer-Encoding: 8bit
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Borisov <lex.borisov@gmail.com>
3+
Date: Fri, 5 Jun 2026 22:13:32 +0300
4+
Subject: [PATCH 8/8] URL: fixed uninitialized memory in the path buffer
5+
growth.
6+
7+
When a path was long enough to outgrow the on-stack buffer, the first
8+
move to the heap didn't copy what was already written, so the start of
9+
the path could contain garbage. Also fixed the 'last' pointer after the
10+
move.
11+
12+
Per report from Recep Asan (recep@asan.me)
13+
---
14+
source/lexbor/url/url.c | 3 ++-
15+
1 file changed, 2 insertions(+), 1 deletion(-)
16+
17+
diff --git a/source/lexbor/url/url.c b/source/lexbor/url/url.c
18+
index 86bcf8f..b6c0a1e 100644
19+
--- a/source/lexbor/url/url.c
20+
+++ b/source/lexbor/url/url.c
21+
@@ -499,6 +499,7 @@ lxb_url_scheme_length = sizeof(lxb_url_scheme_res) / sizeof(lxb_url_scheme_data_
22+
if (tmp == NULL) { \
23+
return NULL; \
24+
} \
25+
+ memcpy(tmp, (sbuf_begin), offset); \
26+
} \
27+
else { \
28+
tmp = lexbor_realloc((sbuf_begin), new_len); \
29+
@@ -509,7 +510,7 @@ lxb_url_scheme_length = sizeof(lxb_url_scheme_res) / sizeof(lxb_url_scheme_data_
30+
} \
31+
\
32+
(sbuf) = tmp + offset; \
33+
- (last) = sbuf + lst; \
34+
+ (last) = tmp + lst; \
35+
(sbuf_begin) = tmp; \
36+
(sbuf_end) = tmp + new_len; \
37+
} \

0 commit comments

Comments
 (0)