nokogiri 1.11.3 → 1.11.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/dependencies.yml +12 -12
- data/lib/nokogiri/version/constant.rb +1 -1
- data/patches/libxml2/{0002-Remove-script-macro-support.patch → 0001-Remove-script-macro-support.patch} +0 -0
- data/patches/libxml2/{0003-Update-entities-to-remove-handling-of-ssi.patch → 0002-Update-entities-to-remove-handling-of-ssi.patch} +0 -0
- data/patches/libxml2/{0004-libxml2.la-is-in-top_builddir.patch → 0003-libxml2.la-is-in-top_builddir.patch} +1 -1
- data/patches/libxml2/{0008-use-glibc-strlen.patch → 0004-use-glibc-strlen.patch} +0 -0
- data/patches/libxml2/{0009-avoid-isnan-isinf.patch → 0005-avoid-isnan-isinf.patch} +4 -4
- data/patches/libxml2/{0011-update-automake-files-for-arm64.patch → 0006-update-automake-files-for-arm64.patch} +0 -0
- data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +19 -0
- data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
- metadata +10 -14
- data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
- data/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +0 -32
- data/patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch +0 -73
- data/patches/libxml2/0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch +0 -103
- data/patches/libxml2/0010-parser.c-shrink-the-input-buffer-when-appropriate.patch +0 -70
- data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a118942143d2327ae26b7b744c2b8943a8ece19ebe3315d21cc7c4be4cf9c40a
|
4
|
+
data.tar.gz: 4c51403f795de70dbc5632da785e7b73ae1ee778f6e4d6cd6bd9d73c34203b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dabfef7045e1994279ec25815da136b293c7d8b1938f906c329f1ee37a275dddad49e3b8b2b1d98f0c858503f43912f2c1ece7228675a4e05220b3efa9f58b6
|
7
|
+
data.tar.gz: 63741c77111a156e0fe25fded997205cffcf6e94e3404f347edcb758ef6848fd332567528975e5e1ded490e4269d7b87cd92d53f3a2983863925d4af738b7637
|
data/dependencies.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
libxml2:
|
2
|
-
version: "2.9.
|
3
|
-
sha256: "
|
2
|
+
version: "2.9.12"
|
3
|
+
sha256: "c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92"
|
4
4
|
# manually verified checksum:
|
5
5
|
#
|
6
|
-
# $ gpg --verify libxml2-2.9.
|
7
|
-
# gpg: Signature made
|
6
|
+
# $ gpg --verify libxml2-2.9.12.tar.gz.asc ports/archives/libxml2-2.9.12.tar.gz
|
7
|
+
# gpg: Signature made Thu 13 May 2021 02:59:16 PM EDT
|
8
8
|
# gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
|
9
9
|
# gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
|
10
10
|
# gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
|
@@ -17,14 +17,14 @@ libxml2:
|
|
17
17
|
#
|
18
18
|
# -----BEGIN PGP SIGNATURE-----
|
19
19
|
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# =
|
20
|
+
# iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAmCddwQACgkQFViLJllr
|
21
|
+
# 6l11LQgAioRTdfmcC+uK/7+6HPtF/3c5zkX6j8VGYuvFBwZ0jayqMRBAl++fcpjE
|
22
|
+
# JUU/JKebSZ/KCYjzyeOWK/i3Gq77iqm3UbZFB85rqu4a5P3gmj/4STWVyAx0KU3z
|
23
|
+
# G3jKqDhJOt7c0acXb5lh2DngfDa1dn/VGcQcIXsqplNxNr4ET7MnSJjZ3nlxYfW2
|
24
|
+
# E5vWBdPCMUeXDBl6MjYvw9XnGGBLUAaEJWoFToG6jKmVf4GAd9nza20jj5dtbcJq
|
25
|
+
# QEOaSDKDr+f9h2NS8haOhJ9vOpy52PdeGzaFlbRkXarGXuAr8kITgATVs8FAqcgv
|
26
|
+
# MoVhmrO5r2hJf0dCM9fZoYqzpMfmNA==
|
27
|
+
# =KfJ9
|
28
28
|
# -----END PGP SIGNATURE-----
|
29
29
|
#
|
30
30
|
|
File without changes
|
File without changes
|
@@ -16,7 +16,7 @@ index cf96d41..1372d8b 100644
|
|
16
16
|
}
|
17
17
|
|
18
18
|
-libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
|
19
|
-
+$(top_builddir)/libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
|
19
|
+
+$(top_builddir)/libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
|
20
20
|
$(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
|
21
21
|
|
22
22
|
testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES) $(EXTRA_testdso_la_DEPENDENCIES)
|
File without changes
|
@@ -51,7 +51,7 @@ diff --git a/xpath.c b/xpath.c
|
|
51
51
|
index 9f64ab9..5b6d999 100644
|
52
52
|
--- a/xpath.c
|
53
53
|
+++ b/xpath.c
|
54
|
-
@@ -
|
54
|
+
@@ -515,11 +515,7 @@ xmlXPathInit(void) {
|
55
55
|
*/
|
56
56
|
int
|
57
57
|
xmlXPathIsNaN(double val) {
|
@@ -63,16 +63,16 @@ index 9f64ab9..5b6d999 100644
|
|
63
63
|
}
|
64
64
|
|
65
65
|
/**
|
66
|
-
@@ -
|
66
|
+
@@ -530,15 +530,11 @@ xmlXPathIsNaN(double val) {
|
67
67
|
*/
|
68
68
|
int
|
69
69
|
xmlXPathIsInf(double val) {
|
70
70
|
-#ifdef isinf
|
71
71
|
- return isinf(val) ? (val > 0 ? 1 : -1) : 0;
|
72
72
|
-#else
|
73
|
-
if (val >=
|
73
|
+
if (val >= xmlXPathPINF)
|
74
74
|
return 1;
|
75
|
-
if (val <= -
|
75
|
+
if (val <= -xmlXPathPINF)
|
76
76
|
return -1;
|
77
77
|
return 0;
|
78
78
|
-#endif
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
2
|
+
Date: Fri, 15 Nov 2019 11:53:11 +0100
|
3
|
+
Subject: [PATCH] Fix xml2-config check in configure script
|
4
|
+
|
5
|
+
A 'print' option has never been supported. After a recent change to
|
6
|
+
libxml2, invalid options cause xml2-config to fail.
|
7
|
+
diff --git a/configure b/configure
|
8
|
+
index c63adc5..6061227 100755
|
9
|
+
--- a/configure
|
10
|
+
+++ b/configure
|
11
|
+
@@ -14860,7 +14860,7 @@ PKG_CONFIG=$_save_PKG_CONFIG
|
12
|
+
fi
|
13
|
+
|
14
|
+
|
15
|
+
-if test "x$LIBXML_LIBS" = "x" && ${XML_CONFIG} --libs print > /dev/null 2>&1
|
16
|
+
+if test "x$LIBXML_LIBS" = "x" && ${XML_CONFIG} --libs > /dev/null 2>&1
|
17
|
+
then
|
18
|
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml libraries >= $LIBXML_REQUIRED_VERSION" >&5
|
19
|
+
$as_echo_n "checking for libxml libraries >= $LIBXML_REQUIRED_VERSION... " >&6; }
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2021-
|
20
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: racc
|
@@ -371,19 +371,15 @@ files:
|
|
371
371
|
- lib/nokogiri/xslt.rb
|
372
372
|
- lib/nokogiri/xslt/stylesheet.rb
|
373
373
|
- lib/xsd/xmlparser/nokogiri.rb
|
374
|
-
- patches/libxml2/0001-
|
375
|
-
- patches/libxml2/0002-
|
376
|
-
- patches/libxml2/0003-
|
377
|
-
- patches/libxml2/0004-
|
378
|
-
- patches/libxml2/0005-
|
379
|
-
- patches/libxml2/0006-
|
380
|
-
- patches/libxml2/0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch
|
381
|
-
- patches/libxml2/0008-use-glibc-strlen.patch
|
382
|
-
- patches/libxml2/0009-avoid-isnan-isinf.patch
|
383
|
-
- patches/libxml2/0010-parser.c-shrink-the-input-buffer-when-appropriate.patch
|
384
|
-
- patches/libxml2/0011-update-automake-files-for-arm64.patch
|
374
|
+
- patches/libxml2/0001-Remove-script-macro-support.patch
|
375
|
+
- patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch
|
376
|
+
- patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch
|
377
|
+
- patches/libxml2/0004-use-glibc-strlen.patch
|
378
|
+
- patches/libxml2/0005-avoid-isnan-isinf.patch
|
379
|
+
- patches/libxml2/0006-update-automake-files-for-arm64.patch
|
385
380
|
- patches/libxslt/0001-update-automake-files-for-arm64.patch
|
386
|
-
-
|
381
|
+
- patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch
|
382
|
+
- ports/archives/libxml2-2.9.12.tar.gz
|
387
383
|
- ports/archives/libxslt-1.1.34.tar.gz
|
388
384
|
homepage: https://nokogiri.org
|
389
385
|
licenses:
|
@@ -1,78 +0,0 @@
|
|
1
|
-
From c5538465c08a8ea248a370bf55bc39cd3385e4af Mon Sep 17 00:00:00 2001
|
2
|
-
From: Mike Dalessio <mike.dalessio@gmail.com>
|
3
|
-
Date: Thu, 29 Mar 2018 14:09:00 -0400
|
4
|
-
Subject: [PATCH] Revert "Do not URI escape in server side includes"
|
5
|
-
|
6
|
-
This reverts commit 960f0e275616cadc29671a218d7fb9b69eb35588.
|
7
|
-
---
|
8
|
-
HTMLtree.c | 49 +++++++++++--------------------------------------
|
9
|
-
1 file changed, 11 insertions(+), 38 deletions(-)
|
10
|
-
|
11
|
-
diff --git a/HTMLtree.c b/HTMLtree.c
|
12
|
-
index 2fd0c9c..67160c5 100644
|
13
|
-
--- a/HTMLtree.c
|
14
|
-
+++ b/HTMLtree.c
|
15
|
-
@@ -717,49 +717,22 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
|
16
|
-
(!xmlStrcasecmp(cur->name, BAD_CAST "src")) ||
|
17
|
-
((!xmlStrcasecmp(cur->name, BAD_CAST "name")) &&
|
18
|
-
(!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))))) {
|
19
|
-
+ xmlChar *escaped;
|
20
|
-
xmlChar *tmp = value;
|
21
|
-
- /* xmlURIEscapeStr() escapes '"' so it can be safely used. */
|
22
|
-
- xmlBufCCat(buf->buffer, "\"");
|
23
|
-
|
24
|
-
while (IS_BLANK_CH(*tmp)) tmp++;
|
25
|
-
|
26
|
-
- /* URI Escape everything, except server side includes. */
|
27
|
-
- for ( ; ; ) {
|
28
|
-
- xmlChar *escaped;
|
29
|
-
- xmlChar endChar;
|
30
|
-
- xmlChar *end = NULL;
|
31
|
-
- xmlChar *start = (xmlChar *)xmlStrstr(tmp, BAD_CAST "<!--");
|
32
|
-
- if (start != NULL) {
|
33
|
-
- end = (xmlChar *)xmlStrstr(tmp, BAD_CAST "-->");
|
34
|
-
- if (end != NULL) {
|
35
|
-
- *start = '\0';
|
36
|
-
- }
|
37
|
-
- }
|
38
|
-
-
|
39
|
-
- /* Escape the whole string, or until start (set to '\0'). */
|
40
|
-
- escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+");
|
41
|
-
- if (escaped != NULL) {
|
42
|
-
- xmlBufCat(buf->buffer, escaped);
|
43
|
-
- xmlFree(escaped);
|
44
|
-
- } else {
|
45
|
-
- xmlBufCat(buf->buffer, tmp);
|
46
|
-
- }
|
47
|
-
-
|
48
|
-
- if (end == NULL) { /* Everything has been written. */
|
49
|
-
- break;
|
50
|
-
- }
|
51
|
-
-
|
52
|
-
- /* Do not escape anything within server side includes. */
|
53
|
-
- *start = '<'; /* Restore the first character of "<!--". */
|
54
|
-
- end += 3; /* strlen("-->") */
|
55
|
-
- endChar = *end;
|
56
|
-
- *end = '\0';
|
57
|
-
- xmlBufCat(buf->buffer, start);
|
58
|
-
- *end = endChar;
|
59
|
-
- tmp = end;
|
60
|
-
+ /*
|
61
|
-
+ * the < and > have already been escaped at the entity level
|
62
|
-
+ * And doing so here breaks server side includes
|
63
|
-
+ */
|
64
|
-
+ escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+<>");
|
65
|
-
+ if (escaped != NULL) {
|
66
|
-
+ xmlBufWriteQuotedString(buf->buffer, escaped);
|
67
|
-
+ xmlFree(escaped);
|
68
|
-
+ } else {
|
69
|
-
+ xmlBufWriteQuotedString(buf->buffer, value);
|
70
|
-
}
|
71
|
-
-
|
72
|
-
- xmlBufCCat(buf->buffer, "\"");
|
73
|
-
} else {
|
74
|
-
xmlBufWriteQuotedString(buf->buffer, value);
|
75
|
-
}
|
76
|
-
--
|
77
|
-
2.9.5
|
78
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
From 0e1a49c8907645d2e155f0d89d4d9895ac5112b5 Mon Sep 17 00:00:00 2001
|
2
|
-
From: Zhipeng Xie <xiezhipeng1@huawei.com>
|
3
|
-
Date: Thu, 12 Dec 2019 17:30:55 +0800
|
4
|
-
Subject: [PATCH] Fix infinite loop in xmlStringLenDecodeEntities
|
5
|
-
|
6
|
-
When ctxt->instate == XML_PARSER_EOF,xmlParseStringEntityRef
|
7
|
-
return NULL which cause a infinite loop in xmlStringLenDecodeEntities
|
8
|
-
|
9
|
-
Found with libFuzzer.
|
10
|
-
|
11
|
-
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
|
12
|
-
---
|
13
|
-
parser.c | 3 ++-
|
14
|
-
1 file changed, 2 insertions(+), 1 deletion(-)
|
15
|
-
|
16
|
-
diff --git a/parser.c b/parser.c
|
17
|
-
index d1c3196..a34bb6c 100644
|
18
|
-
--- a/parser.c
|
19
|
-
+++ b/parser.c
|
20
|
-
@@ -2646,7 +2646,8 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
21
|
-
else
|
22
|
-
c = 0;
|
23
|
-
while ((c != 0) && (c != end) && /* non input consuming loop */
|
24
|
-
- (c != end2) && (c != end3)) {
|
25
|
-
+ (c != end2) && (c != end3) &&
|
26
|
-
+ (ctxt->instate != XML_PARSER_EOF)) {
|
27
|
-
|
28
|
-
if (c == 0) break;
|
29
|
-
if ((c == '&') && (str[1] == '#')) {
|
30
|
-
--
|
31
|
-
2.17.1
|
32
|
-
|
@@ -1,73 +0,0 @@
|
|
1
|
-
From 4f51a6d2b1755ce5b36c524c215aad70d864ac1d Mon Sep 17 00:00:00 2001
|
2
|
-
From: Mike Dalessio <mike.dalessio@gmail.com>
|
3
|
-
Date: Mon, 3 Aug 2020 17:36:05 -0400
|
4
|
-
Subject: [PATCH 1/2] htmlParseComment: treat `--!>` as if it closed the
|
5
|
-
comment
|
6
|
-
|
7
|
-
See guidance provided on incorrectly-closed comments here:
|
8
|
-
|
9
|
-
https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment
|
10
|
-
---
|
11
|
-
HTMLparser.c | 28 ++++++++++++++++++++--------
|
12
|
-
1 file changed, 20 insertions(+), 8 deletions(-)
|
13
|
-
|
14
|
-
diff --git a/HTMLparser.c b/HTMLparser.c
|
15
|
-
index 7b6d689..4d43479 100644
|
16
|
-
--- a/HTMLparser.c
|
17
|
-
+++ b/HTMLparser.c
|
18
|
-
@@ -3300,6 +3300,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
|
19
|
-
int q, ql;
|
20
|
-
int r, rl;
|
21
|
-
int cur, l;
|
22
|
-
+ int next, nl;
|
23
|
-
xmlParserInputState state;
|
24
|
-
|
25
|
-
/*
|
26
|
-
@@ -3332,6 +3333,21 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
|
27
|
-
while (IS_CHAR(cur) &&
|
28
|
-
((cur != '>') ||
|
29
|
-
(r != '-') || (q != '-'))) {
|
30
|
-
+ NEXTL(l);
|
31
|
-
+ next = CUR_CHAR(nl);
|
32
|
-
+ if (next == 0) {
|
33
|
-
+ SHRINK;
|
34
|
-
+ GROW;
|
35
|
-
+ next = CUR_CHAR(nl);
|
36
|
-
+ }
|
37
|
-
+
|
38
|
-
+ if ((q == '-') && (r == '-') && (cur == '!') && (next == '>')) {
|
39
|
-
+ htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
|
40
|
-
+ "Comment incorrectly closed by '--!>'", NULL, NULL);
|
41
|
-
+ cur = '>';
|
42
|
-
+ break;
|
43
|
-
+ }
|
44
|
-
+
|
45
|
-
if (len + 5 >= size) {
|
46
|
-
xmlChar *tmp;
|
47
|
-
|
48
|
-
@@ -3345,18 +3361,14 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
|
49
|
-
}
|
50
|
-
buf = tmp;
|
51
|
-
}
|
52
|
-
- COPY_BUF(ql,buf,len,q);
|
53
|
-
+ COPY_BUF(ql,buf,len,q);
|
54
|
-
+
|
55
|
-
q = r;
|
56
|
-
ql = rl;
|
57
|
-
r = cur;
|
58
|
-
rl = l;
|
59
|
-
- NEXTL(l);
|
60
|
-
- cur = CUR_CHAR(l);
|
61
|
-
- if (cur == 0) {
|
62
|
-
- SHRINK;
|
63
|
-
- GROW;
|
64
|
-
- cur = CUR_CHAR(l);
|
65
|
-
- }
|
66
|
-
+ cur = next;
|
67
|
-
+ l = nl;
|
68
|
-
}
|
69
|
-
buf[len] = 0;
|
70
|
-
if (IS_CHAR(cur)) {
|
71
|
-
--
|
72
|
-
2.25.1
|
73
|
-
|
@@ -1,103 +0,0 @@
|
|
1
|
-
From b20d746fa7cbb74716171bc49d836af99927e41e Mon Sep 17 00:00:00 2001
|
2
|
-
From: Mike Dalessio <mike.dalessio@gmail.com>
|
3
|
-
Date: Sun, 11 Oct 2020 14:15:37 -0400
|
4
|
-
Subject: [PATCH 2/2] use new htmlParseLookupCommentEnd to find comment ends
|
5
|
-
|
6
|
-
Note that the caret in error messages generated during comment parsing
|
7
|
-
may have moved by one byte.
|
8
|
-
|
9
|
-
See guidance provided on incorrectly-closed comments here:
|
10
|
-
|
11
|
-
https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment
|
12
|
-
---
|
13
|
-
HTMLparser.c | 46 +++++++++++++++++++++++++++++++++++++---------
|
14
|
-
1 file changed, 37 insertions(+), 9 deletions(-)
|
15
|
-
|
16
|
-
diff --git a/HTMLparser.c b/HTMLparser.c
|
17
|
-
index 4d43479..000dc3d 100644
|
18
|
-
--- a/HTMLparser.c
|
19
|
-
+++ b/HTMLparser.c
|
20
|
-
@@ -5331,6 +5331,39 @@ htmlParseLookupChars(htmlParserCtxtPtr ctxt, const xmlChar * stop,
|
21
|
-
return (-1);
|
22
|
-
}
|
23
|
-
|
24
|
-
+/**
|
25
|
-
+ * htmlParseLookupCommentEnd:
|
26
|
-
+ * @ctxt: an HTML parser context
|
27
|
-
+ *
|
28
|
-
+ * Try to find a comment end tag in the input stream
|
29
|
-
+ * The search includes "-->" as well as WHATWG-recommended incorrectly-closed tags.
|
30
|
-
+ * (See https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment)
|
31
|
-
+ * This function has a side effect of (possibly) incrementing ctxt->checkIndex
|
32
|
-
+ * to avoid rescanning sequences of bytes, it DOES change the state of the
|
33
|
-
+ * parser, do not use liberally.
|
34
|
-
+ * This wraps to htmlParseLookupSequence()
|
35
|
-
+ *
|
36
|
-
+ * Returns the index to the current parsing point if the full sequence is available, -1 otherwise.
|
37
|
-
+ */
|
38
|
-
+static int
|
39
|
-
+htmlParseLookupCommentEnd(htmlParserCtxtPtr ctxt)
|
40
|
-
+{
|
41
|
-
+ int mark = 0;
|
42
|
-
+ int cur = CUR_PTR - BASE_PTR;
|
43
|
-
+
|
44
|
-
+ while (mark >= 0) {
|
45
|
-
+ mark = htmlParseLookupSequence(ctxt, '-', '-', 0, 1, 1);
|
46
|
-
+ if ((mark < 0) ||
|
47
|
-
+ (NXT(mark+2) == '>') ||
|
48
|
-
+ ((NXT(mark+2) == '!') && (NXT(mark+3) == '>'))) {
|
49
|
-
+ return mark;
|
50
|
-
+ }
|
51
|
-
+ ctxt->checkIndex = cur + mark + 1;
|
52
|
-
+ }
|
53
|
-
+ return mark;
|
54
|
-
+}
|
55
|
-
+
|
56
|
-
+
|
57
|
-
/**
|
58
|
-
* htmlParseTryOrFinish:
|
59
|
-
* @ctxt: an HTML parser context
|
60
|
-
@@ -5507,8 +5540,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
61
|
-
cur = in->cur[0];
|
62
|
-
if ((cur == '<') && (next == '!') &&
|
63
|
-
(in->cur[2] == '-') && (in->cur[3] == '-')) {
|
64
|
-
- if ((!terminate) &&
|
65
|
-
- (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0))
|
66
|
-
+ if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
|
67
|
-
goto done;
|
68
|
-
#ifdef DEBUG_PUSH
|
69
|
-
xmlGenericError(xmlGenericErrorContext,
|
70
|
-
@@ -5567,8 +5599,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
71
|
-
next = in->cur[1];
|
72
|
-
if ((cur == '<') && (next == '!') &&
|
73
|
-
(in->cur[2] == '-') && (in->cur[3] == '-')) {
|
74
|
-
- if ((!terminate) &&
|
75
|
-
- (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0))
|
76
|
-
+ if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
|
77
|
-
goto done;
|
78
|
-
#ifdef DEBUG_PUSH
|
79
|
-
xmlGenericError(xmlGenericErrorContext,
|
80
|
-
@@ -5614,8 +5645,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
81
|
-
next = in->cur[1];
|
82
|
-
if ((cur == '<') && (next == '!') &&
|
83
|
-
(in->cur[2] == '-') && (in->cur[3] == '-')) {
|
84
|
-
- if ((!terminate) &&
|
85
|
-
- (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0))
|
86
|
-
+ if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
|
87
|
-
goto done;
|
88
|
-
#ifdef DEBUG_PUSH
|
89
|
-
xmlGenericError(xmlGenericErrorContext,
|
90
|
-
@@ -5871,9 +5901,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
91
|
-
htmlParseDocTypeDecl(ctxt);
|
92
|
-
} else if ((cur == '<') && (next == '!') &&
|
93
|
-
(in->cur[2] == '-') && (in->cur[3] == '-')) {
|
94
|
-
- if ((!terminate) &&
|
95
|
-
- (htmlParseLookupSequence(
|
96
|
-
- ctxt, '-', '-', '>', 1, 1) < 0))
|
97
|
-
+ if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
|
98
|
-
goto done;
|
99
|
-
#ifdef DEBUG_PUSH
|
100
|
-
xmlGenericError(xmlGenericErrorContext,
|
101
|
-
--
|
102
|
-
2.25.1
|
103
|
-
|
@@ -1,70 +0,0 @@
|
|
1
|
-
From ca565c1edef9a455453fa8564270cc9c5813e1b9 Mon Sep 17 00:00:00 2001
|
2
|
-
From: Mike Dalessio <mike.dalessio@gmail.com>
|
3
|
-
Date: Sun, 31 Jan 2021 09:53:56 -0500
|
4
|
-
Subject: [PATCH] parser.c: shrink the input buffer when appropriate
|
5
|
-
|
6
|
-
Fixes GNOME/libxml2#200
|
7
|
-
|
8
|
-
Also see discussions at:
|
9
|
-
- GNOME/libxml2#192
|
10
|
-
- https://gitlab.gnome.org/nwellnhof/libxml2/-/commit/99bda1e
|
11
|
-
- https://github.com/sparklemotion/nokogiri/issues/2132
|
12
|
-
---
|
13
|
-
parser.c | 6 ++++++
|
14
|
-
1 file changed, 6 insertions(+)
|
15
|
-
|
16
|
-
diff --git a/parser.c b/parser.c
|
17
|
-
index a7bdc7f..efde672 100644
|
18
|
-
--- a/parser.c
|
19
|
-
+++ b/parser.c
|
20
|
-
@@ -4204,6 +4204,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
|
21
|
-
}
|
22
|
-
count++;
|
23
|
-
if (count > 50) {
|
24
|
-
+ SHRINK;
|
25
|
-
GROW;
|
26
|
-
count = 0;
|
27
|
-
if (ctxt->instate == XML_PARSER_EOF) {
|
28
|
-
@@ -4291,6 +4292,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
|
29
|
-
buf[len++] = cur;
|
30
|
-
count++;
|
31
|
-
if (count > 50) {
|
32
|
-
+ SHRINK;
|
33
|
-
GROW;
|
34
|
-
count = 0;
|
35
|
-
if (ctxt->instate == XML_PARSER_EOF) {
|
36
|
-
@@ -4571,6 +4573,7 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
|
37
|
-
}
|
38
|
-
count++;
|
39
|
-
if (count > 50) {
|
40
|
-
+ SHRINK;
|
41
|
-
GROW;
|
42
|
-
count = 0;
|
43
|
-
if (ctxt->instate == XML_PARSER_EOF)
|
44
|
-
@@ -4776,6 +4779,7 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
|
45
|
-
|
46
|
-
count++;
|
47
|
-
if (count > 50) {
|
48
|
-
+ SHRINK;
|
49
|
-
GROW;
|
50
|
-
count = 0;
|
51
|
-
if (ctxt->instate == XML_PARSER_EOF) {
|
52
|
-
@@ -5186,6 +5190,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
53
|
-
}
|
54
|
-
count++;
|
55
|
-
if (count > 50) {
|
56
|
-
+ SHRINK;
|
57
|
-
GROW;
|
58
|
-
if (ctxt->instate == XML_PARSER_EOF) {
|
59
|
-
xmlFree(buf);
|
60
|
-
@@ -9783,6 +9788,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
61
|
-
sl = l;
|
62
|
-
count++;
|
63
|
-
if (count > 50) {
|
64
|
-
+ SHRINK;
|
65
|
-
GROW;
|
66
|
-
if (ctxt->instate == XML_PARSER_EOF) {
|
67
|
-
xmlFree(buf);
|
68
|
-
--
|
69
|
-
2.25.1
|
70
|
-
|
Binary file
|