nokogiri 1.18.9 → 1.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e172a06a5a69eb0ed0203096425f18ffbe6c079a5a179b1760684e0717ec875
4
- data.tar.gz: ba4805c9b64fdde8aeaacaadf0175ebcc8c4eed9d3cbd1b0e2c14699e4dd2901
3
+ metadata.gz: 29a8cf23bf9b784bf84cf87043a08212ea4e6da9badd61f6991c9d97dbb1da2a
4
+ data.tar.gz: 8f2237b720384a66ada6857634e63a9f22f49b37498b20d1c9fbe6940229a06c
5
5
  SHA512:
6
- metadata.gz: 5a1bc7b561ea0c93a1d9d56c1f5f3d0cf6ec5014f7c51b3661b4881d8fc6d9f98e309a7d1659dbd84674defdc692f9337d6dff3fd65cc90b42f0f2a9ef7b407e
7
- data.tar.gz: 3bbb0472af4cf797859667683b46ec7f647eba86680f19f59dda45a9571b861b8a21680318d5f5cac307b71545f19759b805aa07dc8ca4b9ab21d3d980607222
6
+ metadata.gz: 3af2de0a353b9d763b4ede60b22bba65de24c700fe8ba49bd11e5317e07e1d5ecc894ad98509735f3123fa7202a6686c00c0f0377ffca8b090bf258781ff58e0
7
+ data.tar.gz: 7d507866d672767fee8cffea87da06e870815afe29b73c58901ac5cff281b37c0d4163a96f0221c0f166b55e2b04044ff935da4b3b37d9d7cbc2b06e4f95d351
data/Gemfile CHANGED
@@ -6,19 +6,19 @@ gemspec
6
6
 
7
7
  group :development do
8
8
  # bootstrapping
9
- gem "bundler", "~> 2.3"
10
9
  gem "rake", "13.2.1"
11
10
 
12
11
  # building extensions
13
- gem "rake-compiler", "1.2.8"
14
- gem "rake-compiler-dock", "1.7.0"
12
+ gem "rake-compiler", "1.3.1"
13
+ gem "rake-compiler-dock", "1.11.1"
15
14
 
16
15
  # parser generator
17
16
  gem "rexical", "1.0.8"
18
17
 
19
18
  # tests
20
- gem "minitest", "5.25.4"
21
- gem "minitest-parallel_fork", "2.0.0"
19
+ gem "minitest", "6.0.1"
20
+ gem "minitest-mock", "5.27.0"
21
+ gem "minitest-parallel_fork", "2.1.1"
22
22
  gem "ruby_memcheck", "3.0.0"
23
23
  gem "rubyzip", "~> 2.3.2"
24
24
  gem "simplecov", "= 0.21.2"
@@ -36,5 +36,5 @@ end
36
36
  # `bundle config set --local without rdoc`
37
37
  # Then re-run `bundle install`.
38
38
  group :rdoc do
39
- gem "rdoc", "6.10.0" unless RUBY_PLATFORM == "java" || ENV["CI"]
39
+ gem "rdoc", "7.0.3" unless RUBY_PLATFORM == "java" || ENV["CI"]
40
40
  end
@@ -25,6 +25,7 @@ Note that this document is broken into multiple sections, each of which describe
25
25
  * [net.sourceforge.htmlunit:neko-htmlunit](#netsourceforgehtmlunitneko-htmlunit)
26
26
  * [nu.validator:jing](#nuvalidatorjing)
27
27
  * [org.nokogiri:nekodtd](#orgnokogirinekodtd)
28
+ * [org.xmlresolver:xmlresolver](#orgxmlresolverxmlresolver)
28
29
  * [xalan:serializer and xalan:xalan](#xalanserializer-and-xalanxalan)
29
30
  * [xerces:xercesImpl](#xercesxercesimpl)
30
31
  * [xml-apis:xml-apis](#xml-apisxml-apis)
@@ -98,6 +99,7 @@ The Java platform release distributes the following dependencies as compiled jar
98
99
  * [net.sourceforge.htmlunit:neko-htmlunit](#netsourceforgehtmlunitneko-htmlunit)
99
100
  * [nu.validator:jing](#nuvalidatorjing)
100
101
  * [org.nokogiri:nekodtd](#orgnokogirinekodtd)
102
+ * [org.xmlresolver:xmlresolver](#orgxmlresolverxmlresolver)
101
103
  * [xalan:serializer and xalan:xalan](#xalanserializer-and-xalanxalan)
102
104
  * [xerces:xercesImpl](#xercesxercesimpl)
103
105
  * [xml-apis:xml-apis](#xml-apisxml-apis)
@@ -1661,6 +1663,191 @@ https://github.com/sparklemotion/nekodtd
1661
1663
  END OF TERMS AND CONDITIONS
1662
1664
 
1663
1665
 
1666
+ ### org.xmlresolver:xmlresolver
1667
+
1668
+ Apache 2.0
1669
+
1670
+ https://xmlresolver.org/
1671
+
1672
+ Apache License
1673
+ Version 2.0, January 2004
1674
+ http://www.apache.org/licenses/
1675
+
1676
+
1677
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1678
+
1679
+ 1. Definitions.
1680
+
1681
+ "License" shall mean the terms and conditions for use, reproduction,
1682
+ and distribution as defined by Sections 1 through 9 of this document.
1683
+
1684
+ "Licensor" shall mean the copyright owner or entity authorized by
1685
+ the copyright owner that is granting the License.
1686
+
1687
+ "Legal Entity" shall mean the union of the acting entity and all
1688
+ other entities that control, are controlled by, or are under common
1689
+ control with that entity. For the purposes of this definition,
1690
+ "control" means (i) the power, direct or indirect, to cause the
1691
+ direction or management of such entity, whether by contract or
1692
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
1693
+ outstanding shares, or (iii) beneficial ownership of such entity.
1694
+
1695
+ "You" (or "Your") shall mean an individual or Legal Entity
1696
+ exercising permissions granted by this License.
1697
+
1698
+ "Source" form shall mean the preferred form for making modifications,
1699
+ including but not limited to software source code, documentation
1700
+ source, and configuration files.
1701
+
1702
+ "Object" form shall mean any form resulting from mechanical
1703
+ transformation or translation of a Source form, including but
1704
+ not limited to compiled object code, generated documentation,
1705
+ and conversions to other media types.
1706
+
1707
+ "Work" shall mean the work of authorship, whether in Source or
1708
+ Object form, made available under the License, as indicated by a
1709
+ copyright notice that is included in or attached to the work
1710
+ (an example is provided in the Appendix below).
1711
+
1712
+ "Derivative Works" shall mean any work, whether in Source or Object
1713
+ form, that is based on (or derived from) the Work and for which the
1714
+ editorial revisions, annotations, elaborations, or other modifications
1715
+ represent, as a whole, an original work of authorship. For the purposes
1716
+ of this License, Derivative Works shall not include works that remain
1717
+ separable from, or merely link (or bind by name) to the interfaces of,
1718
+ the Work and Derivative Works thereof.
1719
+
1720
+ "Contribution" shall mean any work of authorship, including
1721
+ the original version of the Work and any modifications or additions
1722
+ to that Work or Derivative Works thereof, that is intentionally
1723
+ submitted to Licensor for inclusion in the Work by the copyright owner
1724
+ or by an individual or Legal Entity authorized to submit on behalf of
1725
+ the copyright owner. For the purposes of this definition, "submitted"
1726
+ means any form of electronic, verbal, or written communication sent
1727
+ to the Licensor or its representatives, including but not limited to
1728
+ communication on electronic mailing lists, source code control systems,
1729
+ and issue tracking systems that are managed by, or on behalf of, the
1730
+ Licensor for the purpose of discussing and improving the Work, but
1731
+ excluding communication that is conspicuously marked or otherwise
1732
+ designated in writing by the copyright owner as "Not a Contribution."
1733
+
1734
+ "Contributor" shall mean Licensor and any individual or Legal Entity
1735
+ on behalf of whom a Contribution has been received by Licensor and
1736
+ subsequently incorporated within the Work.
1737
+
1738
+ 2. Grant of Copyright License. Subject to the terms and conditions of
1739
+ this License, each Contributor hereby grants to You a perpetual,
1740
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1741
+ copyright license to reproduce, prepare Derivative Works of,
1742
+ publicly display, publicly perform, sublicense, and distribute the
1743
+ Work and such Derivative Works in Source or Object form.
1744
+
1745
+ 3. Grant of Patent License. Subject to the terms and conditions of
1746
+ this License, each Contributor hereby grants to You a perpetual,
1747
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1748
+ (except as stated in this section) patent license to make, have made,
1749
+ use, offer to sell, sell, import, and otherwise transfer the Work,
1750
+ where such license applies only to those patent claims licensable
1751
+ by such Contributor that are necessarily infringed by their
1752
+ Contribution(s) alone or by combination of their Contribution(s)
1753
+ with the Work to which such Contribution(s) was submitted. If You
1754
+ institute patent litigation against any entity (including a
1755
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
1756
+ or a Contribution incorporated within the Work constitutes direct
1757
+ or contributory patent infringement, then any patent licenses
1758
+ granted to You under this License for that Work shall terminate
1759
+ as of the date such litigation is filed.
1760
+
1761
+ 4. Redistribution. You may reproduce and distribute copies of the
1762
+ Work or Derivative Works thereof in any medium, with or without
1763
+ modifications, and in Source or Object form, provided that You
1764
+ meet the following conditions:
1765
+
1766
+ (a) You must give any other recipients of the Work or
1767
+ Derivative Works a copy of this License; and
1768
+
1769
+ (b) You must cause any modified files to carry prominent notices
1770
+ stating that You changed the files; and
1771
+
1772
+ (c) You must retain, in the Source form of any Derivative Works
1773
+ that You distribute, all copyright, patent, trademark, and
1774
+ attribution notices from the Source form of the Work,
1775
+ excluding those notices that do not pertain to any part of
1776
+ the Derivative Works; and
1777
+
1778
+ (d) If the Work includes a "NOTICE" text file as part of its
1779
+ distribution, then any Derivative Works that You distribute must
1780
+ include a readable copy of the attribution notices contained
1781
+ within such NOTICE file, excluding those notices that do not
1782
+ pertain to any part of the Derivative Works, in at least one
1783
+ of the following places: within a NOTICE text file distributed
1784
+ as part of the Derivative Works; within the Source form or
1785
+ documentation, if provided along with the Derivative Works; or,
1786
+ within a display generated by the Derivative Works, if and
1787
+ wherever such third-party notices normally appear. The contents
1788
+ of the NOTICE file are for informational purposes only and
1789
+ do not modify the License. You may add Your own attribution
1790
+ notices within Derivative Works that You distribute, alongside
1791
+ or as an addendum to the NOTICE text from the Work, provided
1792
+ that such additional attribution notices cannot be construed
1793
+ as modifying the License.
1794
+
1795
+ You may add Your own copyright statement to Your modifications and
1796
+ may provide additional or different license terms and conditions
1797
+ for use, reproduction, or distribution of Your modifications, or
1798
+ for any such Derivative Works as a whole, provided Your use,
1799
+ reproduction, and distribution of the Work otherwise complies with
1800
+ the conditions stated in this License.
1801
+
1802
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
1803
+ any Contribution intentionally submitted for inclusion in the Work
1804
+ by You to the Licensor shall be under the terms and conditions of
1805
+ this License, without any additional terms or conditions.
1806
+ Notwithstanding the above, nothing herein shall supersede or modify
1807
+ the terms of any separate license agreement you may have executed
1808
+ with Licensor regarding such Contributions.
1809
+
1810
+ 6. Trademarks. This License does not grant permission to use the trade
1811
+ names, trademarks, service marks, or product names of the Licensor,
1812
+ except as required for reasonable and customary use in describing the
1813
+ origin of the Work and reproducing the content of the NOTICE file.
1814
+
1815
+ 7. Disclaimer of Warranty. Unless required by applicable law or
1816
+ agreed to in writing, Licensor provides the Work (and each
1817
+ Contributor provides its Contributions) on an "AS IS" BASIS,
1818
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1819
+ implied, including, without limitation, any warranties or conditions
1820
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1821
+ PARTICULAR PURPOSE. You are solely responsible for determining the
1822
+ appropriateness of using or redistributing the Work and assume any
1823
+ risks associated with Your exercise of permissions under this License.
1824
+
1825
+ 8. Limitation of Liability. In no event and under no legal theory,
1826
+ whether in tort (including negligence), contract, or otherwise,
1827
+ unless required by applicable law (such as deliberate and grossly
1828
+ negligent acts) or agreed to in writing, shall any Contributor be
1829
+ liable to You for damages, including any direct, indirect, special,
1830
+ incidental, or consequential damages of any character arising as a
1831
+ result of this License or out of the use or inability to use the
1832
+ Work (including but not limited to damages for loss of goodwill,
1833
+ work stoppage, computer failure or malfunction, or any and all
1834
+ other commercial damages or losses), even if such Contributor
1835
+ has been advised of the possibility of such damages.
1836
+
1837
+ 9. Accepting Warranty or Additional Liability. While redistributing
1838
+ the Work or Derivative Works thereof, You may choose to offer,
1839
+ and charge a fee for, acceptance of support, warranty, indemnity,
1840
+ or other liability obligations and/or rights consistent with this
1841
+ License. However, in accepting such obligations, You may act only
1842
+ on Your own behalf and on Your sole responsibility, not on behalf
1843
+ of any other Contributor, and only if You agree to indemnify,
1844
+ defend, and hold each Contributor harmless for any liability
1845
+ incurred by, or claims asserted against, such Contributor by reason
1846
+ of your accepting any such warranty or additional liability.
1847
+
1848
+ END OF TERMS AND CONDITIONS
1849
+
1850
+
1664
1851
  ### xalan:serializer and xalan:xalan
1665
1852
 
1666
1853
  Apache 2.0
data/README.md CHANGED
@@ -114,8 +114,8 @@ You can help sponsor the maintainers of this software through one of these organ
114
114
 
115
115
  Requirements:
116
116
 
117
- - Ruby >= 3.1
118
- - JRuby >= 9.4.0.0
117
+ - Ruby >= 3.2
118
+ - JRuby >= 10.0
119
119
 
120
120
  If you are compiling the native extension against a system version of libxml2:
121
121
 
@@ -135,7 +135,7 @@ Nokogiri ships pre-compiled, "native" gems for the following platforms:
135
135
  - `x86_64-linux-musl`, `aarch64-linux-musl`, and `arm-linux-musl`
136
136
  - Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
137
137
  - Windows: `x64-mingw-ucrt`
138
- - Java: any platform running JRuby 9.4 or higher
138
+ - Java: any platform running JRuby 10.0 or higher
139
139
 
140
140
  To determine whether your system supports one of these gems, look at the output of `bundle platform` or `ruby -e 'puts Gem::Platform.local.to_s'`.
141
141
 
@@ -291,3 +291,18 @@ Some additional libraries may be distributed with your version of Nokogiri. Plea
291
291
  - Sergio Arbeo
292
292
  - Timothy Elliott
293
293
  - Nobuyoshi Nakada
294
+
295
+
296
+ ## Sponsors
297
+
298
+ These folks have generously sponsored Nokogiri's development. Thank you for your support!
299
+
300
+ <p class="sponsors">
301
+ <span style="white-space: nowrap;"><a href="https://sentry.io"><img src="https://nokogiri.org/images/sponsors/sentry-icon.png" alt="Sentry" height="44" style="vertical-align: middle;"></a>&nbsp;<b>Sentry</b></span>
302
+ &nbsp;&nbsp;&nbsp;&nbsp;
303
+ <span style="white-space: nowrap;"><a href="https://codecov.io"><img src="https://nokogiri.org/images/sponsors/codecov-icon.png" alt="Codecov" height="44" style="vertical-align: middle;"></a>&nbsp;<b>Codecov</b></span>
304
+ &nbsp;&nbsp;&nbsp;&nbsp;
305
+ <span style="white-space: nowrap;"><a href="https://gusto.com"><img src="https://nokogiri.org/images/sponsors/gusto-icon.png" alt="Gusto" height="44" style="vertical-align: middle;"></a>&nbsp;<b>Gusto</b></span>
306
+ &nbsp;&nbsp;&nbsp;&nbsp;
307
+ <span style="white-space: nowrap;"><a href="https://hasdata.com"><img src="https://nokogiri.org/images/sponsors/hasdata-icon.png" alt="HasData" height="44" style="vertical-align: middle;"></a>&nbsp;<b>HasData</b></span>
308
+ </p>
data/dependencies.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  libxml2:
3
- version: "2.13.8"
4
- sha256: "277294cb33119ab71b2bc81f2f445e9bc9435b893ad15bb2cd2b0e859a0ee84a"
5
- # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.8.sha256sum
3
+ version: "2.13.9"
4
+ sha256: "a2c9ae7b770da34860050c309f903221c67830c86e4a7e760692b803df95143a"
5
+ # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.9.sha256sum
6
6
 
7
7
  libxslt:
8
8
  version: "1.1.43"
@@ -15,28 +15,17 @@ zlib:
15
15
  # SHA-256 hash provided on http://zlib.net/
16
16
 
17
17
  libiconv:
18
- version: "1.17"
19
- sha256: "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313"
20
- # signature verified by following this path:
21
- # - release announced at https://savannah.gnu.org/forum/forum.php?forum_id=10175
22
- # - which links to https://savannah.gnu.org/users/haible as the releaser
23
- # - which links to https://savannah.gnu.org/people/viewgpg.php?user_id=1871 as the gpg key
24
- #
25
- # So:
26
- # - wget -q -O - https://savannah.gnu.org/people/viewgpg.php?user_id=1871 | gpg --import
27
- # gpg: key F5BE8B267C6A406D: 1 signature not checked due to a missing key
18
+ # $ gpg --keyserver keyserver.ubuntu.com --recv 9001B85AF9E1B83DF1BDA942F5BE8B267C6A406D
28
19
  # gpg: key F5BE8B267C6A406D: public key "Bruno Haible (Open Source Development) <bruno@clisp.org>" imported
29
20
  # gpg: Total number processed: 1
30
21
  # gpg: imported: 1
31
- # gpg: marginals needed: 3 completes needed: 1 trust model: pgp
32
- # gpg: depth: 0 valid: 4 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 4u
33
- # gpg: next trustdb check due at 2024-05-09
34
- # - gpg --verify libiconv-1.17.tar.gz.sig ports/archives/libiconv-1.17.tar.gz
35
- # gpg: Signature made Sun 15 May 2022 11:26:42 AM EDT
22
+ # $ gpg --verify libiconv-1.18.tar.gz.sig ports/archives/libiconv-1.18.tar.gz
23
+ # gpg: Signature made Sun 15 Dec 2024 07:26:18 AM EST
36
24
  # gpg: using RSA key 9001B85AF9E1B83DF1BDA942F5BE8B267C6A406D
37
- # gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [unknown]
38
- # gpg: WARNING: This key is not certified with a trusted signature!
39
- # gpg: There is no indication that the signature belongs to the owner.
25
+ # gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [expired]
26
+ # gpg: Note: This key has expired!
40
27
  # Primary key fingerprint: 9001 B85A F9E1 B83D F1BD A942 F5BE 8B26 7C6A 406D
41
- #
42
- # And this sha256sum is calculated from that verified tarball.
28
+ # $ sha256sum ports/archives/libiconv-1.18.tar.gz
29
+ # 3b08f5f4f9b4eb82f151a7040bfd6fe6c6fb922efe4b1659c66ea933276965e8 ports/archives/libiconv-1.18.tar.gz
30
+ version: "1.18"
31
+ sha256: "3b08f5f4f9b4eb82f151a7040bfd6fe6c6fb922efe4b1659c66ea933276965e8"
@@ -619,7 +619,7 @@ end
619
619
  def needs_darwin_linker_hack
620
620
  config_cross_build? &&
621
621
  darwin? &&
622
- Gem::Requirement.new("~> 3.2").satisfied_by?(Gem::Version.new(RbConfig::CONFIG["ruby_version"].split("+").first))
622
+ Gem::Requirement.new(">= 3.2").satisfied_by?(Gem::Version.new(RbConfig::CONFIG["ruby_version"].split("+").first))
623
623
  end
624
624
 
625
625
  #
@@ -832,7 +832,7 @@ else
832
832
  cross_build_p,
833
833
  ) do |recipe|
834
834
  recipe.files = [{
835
- url: "https://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
835
+ url: "https://ftpmirror.gnu.org/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
836
836
  sha256: dependencies["libiconv"]["sha256"],
837
837
  }]
838
838
 
@@ -652,15 +652,19 @@ rb_xml_document_canonicalize(int argc, VALUE *argv, VALUE self)
652
652
  }
653
653
  }
654
654
 
655
- xmlC14NExecute(c_doc, c_callback_wrapper, rb_callback,
656
- c_mode,
657
- c_namespaces,
658
- (int)RTEST(rb_comments_p),
659
- c_obuf);
655
+ int ret = xmlC14NExecute(c_doc, c_callback_wrapper, rb_callback,
656
+ c_mode,
657
+ c_namespaces,
658
+ (int)RTEST(rb_comments_p),
659
+ c_obuf);
660
660
 
661
661
  ruby_xfree(c_namespaces);
662
662
  xmlOutputBufferClose(c_obuf);
663
663
 
664
+ if (ret < 0) {
665
+ rb_raise(rb_eRuntimeError, "canonicalization failed");
666
+ }
667
+
664
668
  return rb_funcall(rb_io, rb_intern("string"), 0);
665
669
  }
666
670
 
@@ -133,6 +133,35 @@ rb_xslt_stylesheet_serialize(VALUE self, VALUE xmlobj)
133
133
  return rval ;
134
134
  }
135
135
 
136
+
137
+ /*
138
+ * Build the C-string params array passed to xsltApplyStylesheet.
139
+ *
140
+ * Note: params[j] is a raw pointer into a Ruby string's buffer, and we do not pin the underlying
141
+ * VALUEs against GC compaction. This is safe (despite not pinning the VALUEs) because libxslt fully
142
+ * processes params (interning names, evaluating values) before template execution begins, and Ruby
143
+ * callbacks can only run during template execution. By the time GC compaction is reachable, libxslt
144
+ * no longer reads params[].
145
+ */
146
+ typedef struct {
147
+ VALUE rb_param;
148
+ long param_len;
149
+ const char **params;
150
+ } build_xslt_params_args_t;
151
+
152
+ static VALUE
153
+ build_xslt_params(VALUE args_ptr)
154
+ {
155
+ build_xslt_params_args_t *args = (build_xslt_params_args_t *)args_ptr;
156
+
157
+ for (long j = 0; j < args->param_len; j++) {
158
+ VALUE entry = rb_ary_entry(args->rb_param, j);
159
+ args->params[j] = StringValueCStr(entry);
160
+ }
161
+
162
+ return Qnil;
163
+ }
164
+
136
165
  /*
137
166
  * call-seq:
138
167
  * transform(document)
@@ -254,7 +283,7 @@ rb_xslt_stylesheet_transform(int argc, VALUE *argv, VALUE self)
254
283
  xmlDocPtr c_result_document ;
255
284
  nokogiriXsltStylesheetTuple *wrapper;
256
285
  const char **params ;
257
- long param_len, j ;
286
+ long param_len ;
258
287
  int parse_error_occurred ;
259
288
  int defensive_copy_p = 0;
260
289
 
@@ -277,10 +306,17 @@ rb_xslt_stylesheet_transform(int argc, VALUE *argv, VALUE self)
277
306
 
278
307
  param_len = RARRAY_LEN(rb_param);
279
308
  params = ruby_xcalloc((size_t)param_len + 1, sizeof(char *));
280
- for (j = 0 ; j < param_len ; j++) {
281
- VALUE entry = rb_ary_entry(rb_param, j);
282
- const char *ptr = StringValueCStr(entry);
283
- params[j] = ptr;
309
+ {
310
+ // populate params under rb_protect so that a raise from StringValueCStr
311
+ // (e.g. on a null byte) does not leak the params allocation.
312
+ build_xslt_params_args_t args = { rb_param, param_len, params };
313
+ int state = 0;
314
+
315
+ rb_protect(build_xslt_params, (VALUE)&args, &state);
316
+ if (state) {
317
+ ruby_xfree(params);
318
+ rb_jump_tag(state);
319
+ }
284
320
  }
285
321
  params[param_len] = 0 ;
286
322
 
@@ -1,8 +1,6 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require "set"
5
-
6
4
  module Nokogiri
7
5
  #
8
6
  # Some classes in Nokogiri are namespaced as a group, for example
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #--
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by rex 1.0.7
4
+ # This file is automatically generated by rex 1.0.8
5
5
  # from lexical definition file "lib/nokogiri/css/tokenizer.rex".
6
6
  #++
7
7
 
@@ -63,13 +63,13 @@ class Tokenizer
63
63
  when (text = @ss.scan(/has\([\s]*/))
64
64
  action { [:HAS, text] }
65
65
 
66
- when (text = @ss.scan(/-?([_A-Za-z]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))([_A-Za-z0-9-]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*\([\s]*/))
66
+ when (text = @ss.scan(/-?(?>[_A-Za-z]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))(?>[_A-Za-z0-9-]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*\([\s]*/))
67
67
  action { [:FUNCTION, text] }
68
68
 
69
- when (text = @ss.scan(/-?([_A-Za-z]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))([_A-Za-z0-9-]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*/))
69
+ when (text = @ss.scan(/-?(?>[_A-Za-z]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))(?>[_A-Za-z0-9-]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*/))
70
70
  action { [:IDENT, text] }
71
71
 
72
- when (text = @ss.scan(/\#([_A-Za-z0-9-]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))+/))
72
+ when (text = @ss.scan(/\#(?>[_A-Za-z0-9-]|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))+/))
73
73
  action { [:HASH, text] }
74
74
 
75
75
  when (text = @ss.scan(/[\s]*~=[\s]*/))
@@ -132,7 +132,7 @@ class Tokenizer
132
132
  when (text = @ss.scan(/[\s]+/))
133
133
  action { [:S, text] }
134
134
 
135
- when (text = @ss.scan(/("([^\n\r\f"]|(\n|\r\n|\r|\f)|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*(?<!\\)(?:\\{2})*"|'([^\n\r\f']|(\n|\r\n|\r|\f)|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*(?<!\\)(?:\\{2})*')/))
135
+ when (text = @ss.scan(/("(?>[^\n\r\f"\\]|\\?(\n|\r\n|\r|\f)|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*"|'(?>[^\n\r\f'\\]|\\?(\n|\r\n|\r|\f)|[^\0-\177]|(\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f]))*')/))
136
136
  action { [:STRING, text] }
137
137
 
138
138
  when (text = @ss.scan(/./))
@@ -11,13 +11,13 @@ macro
11
11
  unicode \\[0-9A-Fa-f]{1,6}(\r\n|[\s])?
12
12
 
13
13
  escape ({unicode}|\\[^\n\r\f0-9A-Fa-f])
14
- nmchar ([_A-Za-z0-9-]|{nonascii}|{escape})
15
- nmstart ([_A-Za-z]|{nonascii}|{escape})
14
+ nmchar (?>[_A-Za-z0-9-]|{nonascii}|{escape})
15
+ nmstart (?>[_A-Za-z]|{nonascii}|{escape})
16
16
  name {nmstart}{nmchar}*
17
17
  ident -?{name}
18
18
  charref {nmchar}+
19
- string1 "([^\n\r\f"]|{nl}|{nonascii}|{escape})*(?<!\\)(?:\\{2})*"
20
- string2 '([^\n\r\f']|{nl}|{nonascii}|{escape})*(?<!\\)(?:\\{2})*'
19
+ string1 "(?>[^\n\r\f"\\]|\\?{nl}|{nonascii}|{escape})*"
20
+ string2 '(?>[^\n\r\f'\\]|\\?{nl}|{nonascii}|{escape})*'
21
21
  string ({string1}|{string2})
22
22
 
23
23
  rule
@@ -2,37 +2,42 @@
2
2
  begin
3
3
  require 'jar_dependencies'
4
4
  rescue LoadError
5
- require 'xalan/serializer/2.7.3/serializer-2.7.3.jar'
5
+ require 'isorelax/isorelax/20030108/isorelax-20030108.jar'
6
+ require 'org/nokogiri/nekodtd/0.1.11.noko2/nekodtd-0.1.11.noko2.jar'
6
7
  require 'net/sourceforge/htmlunit/neko-htmlunit/2.63.0/neko-htmlunit-2.63.0.jar'
8
+ require 'net/sf/saxon/Saxon-HE/12.7/Saxon-HE-12.7.jar'
9
+ require 'org/xmlresolver/xmlresolver/5.3.3/xmlresolver-5.3.3.jar'
10
+ require 'org/xmlresolver/xmlresolver/5.3.3/xmlresolver-5.3.3-data.jar'
7
11
  require 'nu/validator/jing/20200702VNU/jing-20200702VNU.jar'
8
- require 'xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar'
9
- require 'net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar'
12
+ require 'xalan/serializer/2.7.3/serializer-2.7.3.jar'
10
13
  require 'xalan/xalan/2.7.3/xalan-2.7.3.jar'
14
+ require 'xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar'
11
15
  require 'xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar'
12
- require 'org/nokogiri/nekodtd/0.1.11.noko2/nekodtd-0.1.11.noko2.jar'
13
- require 'isorelax/isorelax/20030108/isorelax-20030108.jar'
14
16
  end
15
17
 
16
18
  if defined? Jars
17
- require_jar 'xalan', 'serializer', '2.7.3'
19
+ require_jar 'isorelax', 'isorelax', '20030108'
20
+ require_jar 'org.nokogiri', 'nekodtd', '0.1.11.noko2'
18
21
  require_jar 'net.sourceforge.htmlunit', 'neko-htmlunit', '2.63.0'
22
+ require_jar 'net.sf.saxon', 'Saxon-HE', '12.7'
23
+ require_jar 'org.xmlresolver', 'xmlresolver', '5.3.3'
24
+ require_jar 'org.xmlresolver', 'xmlresolver', 'data', '5.3.3'
19
25
  require_jar 'nu.validator', 'jing', '20200702VNU'
20
- require_jar 'xerces', 'xercesImpl', '2.12.2'
21
- require_jar 'net.sf.saxon', 'Saxon-HE', '9.6.0-4'
26
+ require_jar 'xalan', 'serializer', '2.7.3'
22
27
  require_jar 'xalan', 'xalan', '2.7.3'
28
+ require_jar 'xerces', 'xercesImpl', '2.12.2'
23
29
  require_jar 'xml-apis', 'xml-apis', '1.4.01'
24
- require_jar 'org.nokogiri', 'nekodtd', '0.1.11.noko2'
25
- require_jar 'isorelax', 'isorelax', '20030108'
26
30
  end
27
31
 
28
32
  module Nokogiri
29
33
  # generated by the :vendor_jars rake task
30
34
  JAR_DEPENDENCIES = {
31
35
  "isorelax:isorelax" => "20030108",
32
- "net.sf.saxon:Saxon-HE" => "9.6.0-4",
36
+ "net.sf.saxon:Saxon-HE" => "12.7",
33
37
  "net.sourceforge.htmlunit:neko-htmlunit" => "2.63.0",
34
38
  "nu.validator:jing" => "20200702VNU",
35
39
  "org.nokogiri:nekodtd" => "0.1.11.noko2",
40
+ "org.xmlresolver:xmlresolver" => "5.3.3",
36
41
  "xalan:serializer" => "2.7.3",
37
42
  "xalan:xalan" => "2.7.3",
38
43
  "xerces:xercesImpl" => "2.12.2",
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nokogiri
4
4
  # The version of Nokogiri you are using
5
- VERSION = "1.18.9"
5
+ VERSION = "1.19.3"
6
6
  end
@@ -76,12 +76,12 @@ module Nokogiri
76
76
  #
77
77
  # ⚠ This option enables entity substitution, contrary to what the name implies.
78
78
  #
79
- # <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
79
+ # 🛡 <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
80
80
  NOENT = 1 << 1
81
81
 
82
82
  # Load external subsets. On by default for XSLT::Stylesheet.
83
83
  #
84
- # <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
84
+ # 🛡 <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
85
85
  DTDLOAD = 1 << 2
86
86
 
87
87
  # Default DTD attributes. On by default for XSLT::Stylesheet.
@@ -111,7 +111,7 @@ module Nokogiri
111
111
  # Forbid network access. On by default for XML::Document, XML::DocumentFragment,
112
112
  # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema.
113
113
  #
114
- # <b>It is UNSAFE to unset this option</b> when parsing untrusted documents.
114
+ # 🛡 <b>It is UNSAFE to unset this option</b> when parsing untrusted documents.
115
115
  NONET = 1 << 11
116
116
 
117
117
  # Do not reuse the context dictionary. Off by default.
@@ -128,8 +128,7 @@ module Nokogiri
128
128
 
129
129
  # Compact small text nodes. Off by default.
130
130
  #
131
- # ⚠ No modification of the DOM tree is allowed after parsing. libxml2 may crash if you try to
132
- # modify the tree.
131
+ # ⚠ No modification of the DOM tree is allowed after parsing.
133
132
  COMPACT = 1 << 16
134
133
 
135
134
  # Parse using XML-1.0 before update 5. Off by default
@@ -140,7 +139,7 @@ module Nokogiri
140
139
 
141
140
  # Relax any hardcoded limit from the parser. Off by default.
142
141
  #
143
- # <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
142
+ # 🛡 <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
144
143
  HUGE = 1 << 19
145
144
 
146
145
  # Support line numbers up to <code>long int</code> (default is a <code>short int</code>). On
@@ -151,7 +150,12 @@ module Nokogiri
151
150
  # The options mask used by default for parsing XML::Document and XML::DocumentFragment
152
151
  DEFAULT_XML = RECOVER | NONET | BIG_LINES
153
152
 
154
- # The options mask used by default used for parsing XSLT::Stylesheet
153
+ # Shorthand options mask useful for parsing XSLT stylesheets:
154
+ # sets RECOVER, NONET, NOENT, DTDLOAD, DTDATTR, NOCDATA, BIG_LINES.
155
+ #
156
+ # 🛡 This option set includes `NOENT` and `DTDLOAD` which are unsafe for untrusted
157
+ # documents. <b>Do not parse untrusted XSLT stylesheets.</b> See Nokogiri::XSLT for more
158
+ # information.
155
159
  DEFAULT_XSLT = RECOVER | NONET | NOENT | DTDLOAD | DTDATTR | NOCDATA | BIG_LINES
156
160
 
157
161
  # The options mask used by default used for parsing HTML4::Document and HTML4::DocumentFragment
@@ -39,7 +39,7 @@ module Nokogiri
39
39
  # of ParserContext#replace_entities. (Recall that the default value of
40
40
  # ParserContext#replace_entities is `false`.)
41
41
  #
42
- # <b>It is UNSAFE to set ParserContext#replace_entities to `true`</b> when parsing untrusted
42
+ # 🛡 <b>It is UNSAFE to set ParserContext#replace_entities to `true`</b> when parsing untrusted
43
43
  # documents.
44
44
  #
45
45
  # 💡 For more information on entity types, see [Wikipedia's page on
@@ -3,15 +3,20 @@
3
3
  module Nokogiri
4
4
  module XSLT
5
5
  ###
6
- # A Stylesheet represents an XSLT Stylesheet object. Stylesheet creation
7
- # is done through Nokogiri.XSLT. Here is an example of transforming
8
- # an XML::Document with a Stylesheet:
6
+ # A Stylesheet represents an XSLT Stylesheet object. Stylesheet creation is done through
7
+ # Nokogiri::XSLT.parse (or the convenience method Nokogiri.XSLT). Here is an example of
8
+ # transforming an XML::Document with a Stylesheet:
9
9
  #
10
10
  # doc = Nokogiri::XML(File.read('some_file.xml'))
11
11
  # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
12
12
  #
13
13
  # xslt.transform(doc) # => Nokogiri::XML::Document
14
14
  #
15
+ # 🛡 <b>This class does not support execution of untrusted stylesheets.</b> An untrusted
16
+ # stylesheet may consume a large amount of CPU, memory, or other system resources during
17
+ # transformation, and IO and file access are not restricted. See Nokogiri::XSLT for more
18
+ # information about the security implications of untrusted stylesheets.
19
+ #
15
20
  # Many XSLT transformations include serialization behavior to emit a non-XML document. For these
16
21
  # cases, please take care to invoke the #serialize method on the result of the transformation:
17
22
  #
data/lib/nokogiri/xslt.rb CHANGED
@@ -10,8 +10,14 @@ module Nokogiri
10
10
  end
11
11
 
12
12
  ###
13
- # See Nokogiri::XSLT::Stylesheet for creating and manipulating
14
- # Stylesheet object.
13
+ # See Nokogiri::XSLT::Stylesheet for creating and manipulating Stylesheet objects.
14
+ #
15
+ # 🛡 <b>Do not use this module for untrusted stylesheet documents.</b> libxslt does not support
16
+ # safely processing untrusted stylesheets. Untrusted stylesheets may access the file system and
17
+ # network, consume large amounts of CPU, memory, or other system resources, and IO and file
18
+ # access are not restricted. Additionally, the stylesheet is parsed by libxml2 with +NOENT+ and
19
+ # +DTDLOAD+ enabled (see ParseOptions::DEFAULT_XSLT), meaning that <b>external entities will be
20
+ # resolved and external subsets will be loaded</b> during parsing.
15
21
  module XSLT
16
22
  class << self
17
23
  # :call-seq:
@@ -20,6 +26,9 @@ module Nokogiri
20
26
  #
21
27
  # Parse the stylesheet in +xsl+, registering optional +modules+ as custom class handlers.
22
28
  #
29
+ # 🛡 <b>Do not pass untrusted stylesheet content to this method.</b> See Nokogiri::XSLT for more
30
+ # information.
31
+ #
23
32
  # [Parameters]
24
33
  # - +xsl+ (String) XSL content to be parsed into a stylesheet
25
34
  # - +modules+ (Hash<String ⇒ Class>) A hash of URI-to-handler relations for linking a
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.18.9
4
+ version: 1.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -272,12 +272,8 @@ files:
272
272
  - patches/libxml2/0010-update-config.guess-and-config.sub-for-libxml2.patch
273
273
  - patches/libxml2/0011-rip-out-libxml2-s-libc_single_threaded-support.patch
274
274
  - patches/libxml2/0019-xpath-Use-separate-static-hash-table-for-standard-fu.patch
275
- - patches/libxml2/0020-CVE-2025-6021-tree-Fix-integer-overflow-in-xmlBuildQ.patch
276
- - patches/libxml2/0021-CVE-2025-6170-Fix-potential-buffer-overflows-of-inte.patch
277
- - patches/libxml2/0022-CVE-2025-49795-schematron-Fix-null-pointer-dereferen.patch
278
- - patches/libxml2/0023-CVE-2025-49794-CVE-2025-49796-schematron-Fix-xmlSche.patch
279
275
  - patches/libxslt/0001-update-config.guess-and-config.sub-for-libxslt.patch
280
- - ports/archives/libxml2-2.13.8.tar.xz
276
+ - ports/archives/libxml2-2.13.9.tar.xz
281
277
  - ports/archives/libxslt-1.1.43.tar.xz
282
278
  homepage: https://nokogiri.org
283
279
  licenses:
@@ -298,14 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
294
  requirements:
299
295
  - - ">="
300
296
  - !ruby/object:Gem::Version
301
- version: 3.1.0
297
+ version: '3.2'
302
298
  required_rubygems_version: !ruby/object:Gem::Requirement
303
299
  requirements:
304
300
  - - ">="
305
301
  - !ruby/object:Gem::Version
306
302
  version: '0'
307
303
  requirements: []
308
- rubygems_version: 3.6.9
304
+ rubygems_version: 4.0.6
309
305
  specification_version: 4
310
306
  summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
311
307
  test_files: []
@@ -1,54 +0,0 @@
1
- From 17d950ae33c23f87692aa179bacedb6743f3188a Mon Sep 17 00:00:00 2001
2
- From: Nick Wellnhofer <wellnhofer@aevum.de>
3
- Date: Tue, 27 May 2025 12:53:17 +0200
4
- Subject: [PATCH 5/9] [CVE-2025-6021] tree: Fix integer overflow in
5
- xmlBuildQName
6
-
7
- Fixes #926.
8
- ---
9
- tree.c | 12 +++++++++---
10
- 1 file changed, 9 insertions(+), 3 deletions(-)
11
-
12
- diff --git a/tree.c b/tree.c
13
- index f097cf87..5bc95b8a 100644
14
- --- a/tree.c
15
- +++ b/tree.c
16
- @@ -47,6 +47,10 @@
17
- #include "private/error.h"
18
- #include "private/tree.h"
19
-
20
- +#ifndef SIZE_MAX
21
- + #define SIZE_MAX ((size_t)-1)
22
- +#endif
23
- +
24
- int __xmlRegisterCallbacks = 0;
25
-
26
- /************************************************************************
27
- @@ -167,10 +171,10 @@ xmlGetParameterEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) {
28
- xmlChar *
29
- xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
30
- xmlChar *memory, int len) {
31
- - int lenn, lenp;
32
- + size_t lenn, lenp;
33
- xmlChar *ret;
34
-
35
- - if (ncname == NULL) return(NULL);
36
- + if ((ncname == NULL) || (len < 0)) return(NULL);
37
- if (prefix == NULL) return((xmlChar *) ncname);
38
-
39
- #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
40
- @@ -181,8 +185,10 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
41
-
42
- lenn = strlen((char *) ncname);
43
- lenp = strlen((char *) prefix);
44
- + if (lenn >= SIZE_MAX - lenp - 1)
45
- + return(NULL);
46
-
47
- - if ((memory == NULL) || (len < lenn + lenp + 2)) {
48
- + if ((memory == NULL) || ((size_t) len < lenn + lenp + 2)) {
49
- ret = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
50
- if (ret == NULL)
51
- return(NULL);
52
- --
53
- 2.50.1
54
-
@@ -1,102 +0,0 @@
1
- From 5e9ec5c107d3f5b5179c3dbc19df43df041cd55b Mon Sep 17 00:00:00 2001
2
- From: Michael Mann <mmann78@netscape.net>
3
- Date: Fri, 20 Jun 2025 23:05:00 -0400
4
- Subject: [PATCH 6/9] [CVE-2025-6170] Fix potential buffer overflows of
5
- interactive shell
6
-
7
- Fixes #941
8
- ---
9
- debugXML.c | 15 ++++++++++-----
10
- result/scripts/long_command | 8 ++++++++
11
- test/scripts/long_command.script | 6 ++++++
12
- test/scripts/long_command.xml | 1 +
13
- 4 files changed, 25 insertions(+), 5 deletions(-)
14
- create mode 100644 result/scripts/long_command
15
- create mode 100644 test/scripts/long_command.script
16
- create mode 100644 test/scripts/long_command.xml
17
-
18
- diff --git a/debugXML.c b/debugXML.c
19
- index ed56b0f8..452b9573 100644
20
- --- a/debugXML.c
21
- +++ b/debugXML.c
22
- @@ -1033,6 +1033,10 @@ xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
23
- xmlCtxtGenericNodeCheck(ctxt, node);
24
- }
25
-
26
- +#define MAX_PROMPT_SIZE 500
27
- +#define MAX_ARG_SIZE 400
28
- +#define MAX_COMMAND_SIZE 100
29
- +
30
- /**
31
- * xmlCtxtDumpNode:
32
- * @output: the FILE * for the output
33
- @@ -2795,10 +2799,10 @@ void
34
- xmlShell(xmlDocPtr doc, const char *filename, xmlShellReadlineFunc input,
35
- FILE * output)
36
- {
37
- - char prompt[500] = "/ > ";
38
- + char prompt[MAX_PROMPT_SIZE] = "/ > ";
39
- char *cmdline = NULL, *cur;
40
- - char command[100];
41
- - char arg[400];
42
- + char command[MAX_COMMAND_SIZE];
43
- + char arg[MAX_ARG_SIZE];
44
- int i;
45
- xmlShellCtxtPtr ctxt;
46
- xmlXPathObjectPtr list;
47
- @@ -2856,7 +2860,8 @@ xmlShell(xmlDocPtr doc, const char *filename, xmlShellReadlineFunc input,
48
- cur++;
49
- i = 0;
50
- while ((*cur != ' ') && (*cur != '\t') &&
51
- - (*cur != '\n') && (*cur != '\r')) {
52
- + (*cur != '\n') && (*cur != '\r') &&
53
- + (i < (MAX_COMMAND_SIZE - 1))) {
54
- if (*cur == 0)
55
- break;
56
- command[i++] = *cur++;
57
- @@ -2871,7 +2876,7 @@ xmlShell(xmlDocPtr doc, const char *filename, xmlShellReadlineFunc input,
58
- while ((*cur == ' ') || (*cur == '\t'))
59
- cur++;
60
- i = 0;
61
- - while ((*cur != '\n') && (*cur != '\r') && (*cur != 0)) {
62
- + while ((*cur != '\n') && (*cur != '\r') && (*cur != 0) && (i < (MAX_ARG_SIZE-1))) {
63
- if (*cur == 0)
64
- break;
65
- arg[i++] = *cur++;
66
- diff --git a/result/scripts/long_command b/result/scripts/long_command
67
- new file mode 100644
68
- index 00000000..e6f00708
69
- --- /dev/null
70
- +++ b/result/scripts/long_command
71
- @@ -0,0 +1,8 @@
72
- +/ > b > b > Object is a Node Set :
73
- +Set contains 1 nodes:
74
- +1 ELEMENT a:c
75
- +b > Unknown command This_is_a_really_long_command_string_designed_to_test_the_limits_of_the_memory_that_stores_the_comm
76
- +b > b > Unknown command ess_currents_of_time_and_existence
77
- +b > <?xml version="1.0"?>
78
- +<a xmlns:a="bar"><b xmlns:a="foo">Navigating_the_labyrinthine_corridors_of_human_cognition_one_often_encounters_the_perplexing_paradox_that_the_more_we_delve_into_the_intricate_dance_of_neural_pathways_and_synaptic_firings_the_further_we_seem_to_stray_from_a_truly_holistic_understanding_of_consciousness_a_phenomenon_that_remains_as_elusive_as_a_moonbeam_caught_in_a_spiderweb_yet_undeniably_shapes_every_fleeting_thought_every_prof</b></a>
79
- +b >
80
-
81
- diff --git a/test/scripts/long_command.script b/test/scripts/long_command.script
82
- new file mode 100644
83
- index 00000000..00f6df09
84
- --- /dev/null
85
- +++ b/test/scripts/long_command.script
86
- @@ -0,0 +1,6 @@
87
- +cd a/b
88
- +set <a:c/>
89
- +xpath //*[namespace-uri()="foo"]
90
- +This_is_a_really_long_command_string_designed_to_test_the_limits_of_the_memory_that_stores_the_command_please_dont_crash foo
91
- +set Navigating_the_labyrinthine_corridors_of_human_cognition_one_often_encounters_the_perplexing_paradox_that_the_more_we_delve_into_the_intricate_dance_of_neural_pathways_and_synaptic_firings_the_further_we_seem_to_stray_from_a_truly_holistic_understanding_of_consciousness_a_phenomenon_that_remains_as_elusive_as_a_moonbeam_caught_in_a_spiderweb_yet_undeniably_shapes_every_fleeting_thought_every_profound_emotion_and_every_grand_aspiration_that_propels_our_species_ever_onward_through_the_relentless_currents_of_time_and_existence
92
- +save -
93
- diff --git a/test/scripts/long_command.xml b/test/scripts/long_command.xml
94
- new file mode 100644
95
- index 00000000..1ba44016
96
- --- /dev/null
97
- +++ b/test/scripts/long_command.xml
98
- @@ -0,0 +1 @@
99
- +<a xmlns:a="bar"><b xmlns:a="foo"/></a>
100
- --
101
- 2.50.1
102
-
@@ -1,69 +0,0 @@
1
- From 62048278a4c5fdf14d287dfb400005c0a0caa69f Mon Sep 17 00:00:00 2001
2
- From: Michael Mann <mmann78@netscape.net>
3
- Date: Sat, 21 Jun 2025 12:11:30 -0400
4
- Subject: [PATCH 7/9] [CVE-2025-49795] schematron: Fix null pointer dereference
5
- leading to DoS
6
-
7
- Fixes #932
8
- ---
9
- result/schematron/zvon16_0.err | 3 +++
10
- schematron.c | 5 +++++
11
- test/schematron/zvon16.sct | 7 +++++++
12
- test/schematron/zvon16_0.xml | 5 +++++
13
- 4 files changed, 20 insertions(+)
14
- create mode 100644 result/schematron/zvon16_0.err
15
- create mode 100644 test/schematron/zvon16.sct
16
- create mode 100644 test/schematron/zvon16_0.xml
17
-
18
- diff --git a/result/schematron/zvon16_0.err b/result/schematron/zvon16_0.err
19
- new file mode 100644
20
- index 00000000..3d052409
21
- --- /dev/null
22
- +++ b/result/schematron/zvon16_0.err
23
- @@ -0,0 +1,3 @@
24
- +XPath error : Unregistered function
25
- +./test/schematron/zvon16_0.xml:2: element book: schematron error : /library/book line 2: Book
26
- +./test/schematron/zvon16_0.xml fails to validate
27
- diff --git a/schematron.c b/schematron.c
28
- index 1de25deb..da603402 100644
29
- --- a/schematron.c
30
- +++ b/schematron.c
31
- @@ -1506,6 +1506,11 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt,
32
- select = xmlGetNoNsProp(child, BAD_CAST "select");
33
- comp = xmlXPathCtxtCompile(ctxt->xctxt, select);
34
- eval = xmlXPathCompiledEval(comp, ctxt->xctxt);
35
- + if (eval == NULL) {
36
- + xmlXPathFreeCompExpr(comp);
37
- + xmlFree(select);
38
- + return ret;
39
- + }
40
-
41
- switch (eval->type) {
42
- case XPATH_NODESET: {
43
- diff --git a/test/schematron/zvon16.sct b/test/schematron/zvon16.sct
44
- new file mode 100644
45
- index 00000000..f03848aa
46
- --- /dev/null
47
- +++ b/test/schematron/zvon16.sct
48
- @@ -0,0 +1,7 @@
49
- +<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
50
- + <sch:pattern id="TestPattern">
51
- + <sch:rule context="book">
52
- + <sch:report test="not(@available)">Book <sch:value-of select="falae()"/> test</sch:report>
53
- + </sch:rule>
54
- + </sch:pattern>
55
- +</sch:schema>
56
- diff --git a/test/schematron/zvon16_0.xml b/test/schematron/zvon16_0.xml
57
- new file mode 100644
58
- index 00000000..551e2d65
59
- --- /dev/null
60
- +++ b/test/schematron/zvon16_0.xml
61
- @@ -0,0 +1,5 @@
62
- +<library>
63
- + <book title="Test Book" id="bk101">
64
- + <author>Test Author</author>
65
- + </book>
66
- +</library>
67
- --
68
- 2.50.1
69
-
@@ -1,182 +0,0 @@
1
- From 81cef8c5b5aec2acdf5707e57a6db0c8d1d0abca Mon Sep 17 00:00:00 2001
2
- From: Nick Wellnhofer <wellnhofer@aevum.de>
3
- Date: Fri, 4 Jul 2025 14:28:26 +0200
4
- Subject: [PATCH 8/9] [CVE-2025-49794] [CVE-2025-49796] schematron: Fix
5
- xmlSchematronReportOutput
6
-
7
- Fix use-after-free (CVE-2025-49794) and type confusion (CVE-2025-49796)
8
- in xmlSchematronReportOutput.
9
-
10
- Fixes #931.
11
- Fixes #933.
12
- ---
13
- result/schematron/cve-2025-49794_0.err | 2 ++
14
- result/schematron/cve-2025-49796_0.err | 2 ++
15
- schematron.c | 49 ++++++++++++++------------
16
- test/schematron/cve-2025-49794.sct | 10 ++++++
17
- test/schematron/cve-2025-49794_0.xml | 6 ++++
18
- test/schematron/cve-2025-49796.sct | 9 +++++
19
- test/schematron/cve-2025-49796_0.xml | 3 ++
20
- 7 files changed, 58 insertions(+), 23 deletions(-)
21
- create mode 100644 result/schematron/cve-2025-49794_0.err
22
- create mode 100644 result/schematron/cve-2025-49796_0.err
23
- create mode 100644 test/schematron/cve-2025-49794.sct
24
- create mode 100644 test/schematron/cve-2025-49794_0.xml
25
- create mode 100644 test/schematron/cve-2025-49796.sct
26
- create mode 100644 test/schematron/cve-2025-49796_0.xml
27
-
28
- diff --git a/result/schematron/cve-2025-49794_0.err b/result/schematron/cve-2025-49794_0.err
29
- new file mode 100644
30
- index 00000000..57752310
31
- --- /dev/null
32
- +++ b/result/schematron/cve-2025-49794_0.err
33
- @@ -0,0 +1,2 @@
34
- +./test/schematron/cve-2025-49794_0.xml:2: element boo0: schematron error : /librar0/boo0 line 2:
35
- +./test/schematron/cve-2025-49794_0.xml fails to validate
36
- diff --git a/result/schematron/cve-2025-49796_0.err b/result/schematron/cve-2025-49796_0.err
37
- new file mode 100644
38
- index 00000000..bf875ee0
39
- --- /dev/null
40
- +++ b/result/schematron/cve-2025-49796_0.err
41
- @@ -0,0 +1,2 @@
42
- +./test/schematron/cve-2025-49796_0.xml:2: element boo0: schematron error : /librar0/boo0 line 2:
43
- +./test/schematron/cve-2025-49796_0.xml fails to validate
44
- diff --git a/schematron.c b/schematron.c
45
- index da603402..6e2ceeb7 100644
46
- --- a/schematron.c
47
- +++ b/schematron.c
48
- @@ -1414,27 +1414,15 @@ xmlSchematronParse(xmlSchematronParserCtxtPtr ctxt)
49
- * *
50
- ************************************************************************/
51
-
52
- -static xmlNodePtr
53
- +static xmlXPathObjectPtr
54
- xmlSchematronGetNode(xmlSchematronValidCtxtPtr ctxt,
55
- xmlNodePtr cur, const xmlChar *xpath) {
56
- - xmlNodePtr node = NULL;
57
- - xmlXPathObjectPtr ret;
58
- -
59
- if ((ctxt == NULL) || (cur == NULL) || (xpath == NULL))
60
- return(NULL);
61
-
62
- ctxt->xctxt->doc = cur->doc;
63
- ctxt->xctxt->node = cur;
64
- - ret = xmlXPathEval(xpath, ctxt->xctxt);
65
- - if (ret == NULL)
66
- - return(NULL);
67
- -
68
- - if ((ret->type == XPATH_NODESET) &&
69
- - (ret->nodesetval != NULL) && (ret->nodesetval->nodeNr > 0))
70
- - node = ret->nodesetval->nodeTab[0];
71
- -
72
- - xmlXPathFreeObject(ret);
73
- - return(node);
74
- + return(xmlXPathEval(xpath, ctxt->xctxt));
75
- }
76
-
77
- /**
78
- @@ -1480,25 +1468,40 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt,
79
- (child->type == XML_CDATA_SECTION_NODE))
80
- ret = xmlStrcat(ret, child->content);
81
- else if (IS_SCHEMATRON(child, "name")) {
82
- + xmlXPathObject *obj = NULL;
83
- xmlChar *path;
84
-
85
- path = xmlGetNoNsProp(child, BAD_CAST "path");
86
-
87
- node = cur;
88
- if (path != NULL) {
89
- - node = xmlSchematronGetNode(ctxt, cur, path);
90
- - if (node == NULL)
91
- - node = cur;
92
- + obj = xmlSchematronGetNode(ctxt, cur, path);
93
- + if ((obj != NULL) &&
94
- + (obj->type == XPATH_NODESET) &&
95
- + (obj->nodesetval != NULL) &&
96
- + (obj->nodesetval->nodeNr > 0))
97
- + node = obj->nodesetval->nodeTab[0];
98
- xmlFree(path);
99
- }
100
-
101
- - if ((node->ns == NULL) || (node->ns->prefix == NULL))
102
- - ret = xmlStrcat(ret, node->name);
103
- - else {
104
- - ret = xmlStrcat(ret, node->ns->prefix);
105
- - ret = xmlStrcat(ret, BAD_CAST ":");
106
- - ret = xmlStrcat(ret, node->name);
107
- + switch (node->type) {
108
- + case XML_ELEMENT_NODE:
109
- + case XML_ATTRIBUTE_NODE:
110
- + if ((node->ns == NULL) || (node->ns->prefix == NULL))
111
- + ret = xmlStrcat(ret, node->name);
112
- + else {
113
- + ret = xmlStrcat(ret, node->ns->prefix);
114
- + ret = xmlStrcat(ret, BAD_CAST ":");
115
- + ret = xmlStrcat(ret, node->name);
116
- + }
117
- + break;
118
- +
119
- + /* TODO: handle other node types */
120
- + default:
121
- + break;
122
- }
123
- +
124
- + xmlXPathFreeObject(obj);
125
- } else if (IS_SCHEMATRON(child, "value-of")) {
126
- xmlChar *select;
127
- xmlXPathObjectPtr eval;
128
- diff --git a/test/schematron/cve-2025-49794.sct b/test/schematron/cve-2025-49794.sct
129
- new file mode 100644
130
- index 00000000..7fc9ee3d
131
- --- /dev/null
132
- +++ b/test/schematron/cve-2025-49794.sct
133
- @@ -0,0 +1,10 @@
134
- +<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
135
- + <sch:pattern id="">
136
- + <sch:rule context="boo0">
137
- + <sch:report test="not(0)">
138
- + <sch:name path="&#9;e|namespace::*|e"/>
139
- + </sch:report>
140
- + <sch:report test="0"></sch:report>
141
- + </sch:rule>
142
- + </sch:pattern>
143
- +</sch:schema>
144
- diff --git a/test/schematron/cve-2025-49794_0.xml b/test/schematron/cve-2025-49794_0.xml
145
- new file mode 100644
146
- index 00000000..debc64ba
147
- --- /dev/null
148
- +++ b/test/schematron/cve-2025-49794_0.xml
149
- @@ -0,0 +1,6 @@
150
- +<librar0>
151
- + <boo0 t="">
152
- + <author></author>
153
- + </boo0>
154
- + <ins></ins>
155
- +</librar0>
156
- diff --git a/test/schematron/cve-2025-49796.sct b/test/schematron/cve-2025-49796.sct
157
- new file mode 100644
158
- index 00000000..e9702d75
159
- --- /dev/null
160
- +++ b/test/schematron/cve-2025-49796.sct
161
- @@ -0,0 +1,9 @@
162
- +<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
163
- + <sch:pattern id="">
164
- + <sch:rule context="boo0">
165
- + <sch:report test="not(0)">
166
- + <sch:name path="/"/>
167
- + </sch:report>
168
- + </sch:rule>
169
- + </sch:pattern>
170
- +</sch:schema>
171
- diff --git a/test/schematron/cve-2025-49796_0.xml b/test/schematron/cve-2025-49796_0.xml
172
- new file mode 100644
173
- index 00000000..be33c4ec
174
- --- /dev/null
175
- +++ b/test/schematron/cve-2025-49796_0.xml
176
- @@ -0,0 +1,3 @@
177
- +<librar0>
178
- + <boo0/>
179
- +</librar0>
180
- --
181
- 2.50.1
182
-
Binary file