leptris 1.9.430.0-arm-linux → 1.9.432.1-arm-linux

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: 28b60b627fdc7728693a0d3c6fbc4cdb239c97e7ee5339c8f60df3dd63c44568
4
- data.tar.gz: c1a80ee2898eaf85b1a3b4b985fc3f6d49317d69b817acdfcc3c9f070a9e5360
3
+ metadata.gz: 6ba225efd2fcbd11ba9246a36bcdd1a3a4de505a28859aff05a070cf2975cea3
4
+ data.tar.gz: 40f60af66050ecdf08d4ee5e4c6555e686a25380c8315e1ee82b6a9a0a1bf7eb
5
5
  SHA512:
6
- metadata.gz: fee28f1d63e16dc94ac4441e160016149f77113f97658e33fccca75eb7deddd06df71fd52f5723ae988d664ca1667e3f1963b501d153fafb5fcc69108f198a81
7
- data.tar.gz: f828d975bfe538a4ca8740b6c80beca7aee2171b430667629a2446566d9654f4f3000987f69431e0b76354b5660d673e58ca6cd0483f3ac7ad6f0c4e1107f48c
6
+ metadata.gz: 14f02307e9a19f180ae29a5d5f46d395363233c3d8a0f31d808c1656a075a5b762aa43264fe11bf7894052480d2d43ba64388e3b229f8555d3455bbe5b3fed49
7
+ data.tar.gz: b86ce7928e04c298e2b128e5dd1dc3b08b16846709eac97251e1bd0117e776a2110e8e8675b6354d6ea8349d84245b90faa054b57e4fe90449f1fda4ea0e803a
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
8
8
  # Pin for `rake compile` and the platform-gem builds. Keep in lockstep
9
9
  # with .github/workflows/build.yml (which calls `rake compile`) and the
10
10
  # CHANGELOG when libleptris releases.
11
- LIBLEPTRIS_VERSION = "1.9.430"
11
+ LIBLEPTRIS_VERSION = "1.9.432"
12
12
 
13
13
  # THE SSOT for the per-minor native bundle list (ruby#645): one line,
14
14
  # space-separated, consumed by the Rakefile, the per-minor builder's
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.430.0"
4
+ VERSION = "1.9.432.1"
5
5
  end
Binary file
Binary file
data/lib/libleptris.so CHANGED
Binary file
data/lib/libutf8proc.so.3 CHANGED
Binary file
data/vendor-src/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Sources vendored in this gem (recompile rights; the ruby
2
2
  variant builds them at install via extconf.rb):
3
3
 
4
- - libleptris v1.9.430
4
+ - libleptris v1.9.432
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,28 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.432] - 2026-11-21
4
+
5
+ ### Fixed
6
+
7
+ - **RELAX NG: refs keep the element branch — the externalRef-splice regression on the 1.9.431 ride.** The 1.9.431 content classifier propagated the leaf mark through ref expansion, so content like `element(e){ref payload}` with `payload = text` routed to the text branch, whose leaf loop cannot resolve refs — every externalRef-spliced text element rejected with "content mismatch" (the ruby v188 lockstep suite caught it: 1273 examples, exactly that one failure). Refs now descend for element patterns but leave the leaf mark unset; the beside-attribute data fix (#2080) is untouched — direct text leaves still route to the text branch.
8
+
9
+
10
+
11
+ ## [1.9.431] - 2026-11-21
12
+
13
+ ### Fixed
14
+
15
+ - **RELAX NG: the data leaf lexes beside attribute patterns** — an attribute pattern (optional or required) beside a `<data>` leaf disabled the datatype lex entirely, so `not-base64!!` validated as base64Binary and garbage validated as every leaf datatype. The content classifier now descends wrappers and refs and answers from the leaves (leptris#2080 residual; one of the two openmath#25 gates).
16
+ - **XSD: anyURI collapses whitespace before the lexical check** — XSD Part 2's collapse facet: space-padded and whitespace-only values trim before the check and the collapsed empty string is a legal anyURI (Jing accepts both; the engine rejected outright — the entire remaining CD-loading delta in the openmath corpus). Interior control characters still reject (leptris#1883's anyURI row; the second openmath#25 gate).
17
+ - **HTML: the foster splice never links a node into a chain cycle** — the 682-byte fuzz input's "229MB tree" was ~8 nodes linked in a sibling cycle and walked forever; foster splices now unlink nodes from every chain and maintain parent back-pointers (leptris#2096; the reconstruct-on-characters behavior is kept per WHATWG 13.2.6.4.7).
18
+ - **Pool: recycled extension blocks always get a tracking node, and blocks smaller than the list header never park** — the AdoptedAttrs arena-boundary sweep caught both in #2105's own CI.
19
+
20
+ ### Performance
21
+
22
+ - **Pool: arena extension blocks recycle across the mutation document cycle** — a create/build/free cycle re-malloc'd and re-faulted hundreds of same-size blocks; extensions now park/pop on a capped thread-local exact-size list. The corrected mutation rows all beat pugixml on CI: append 2.85x, mut-doc-cycle 15.9 vs 16.0 ns/child, attrparse 1.21x (leptris#2054 closed; the bench methodology warms the recycle layers and reports min-of-3).
23
+
24
+
25
+
3
26
  ## [1.9.430] - 2026-11-20
4
27
 
5
28
  ### Fixed
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.430
6
+ VERSION 1.9.432
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -69,9 +69,18 @@ int main(void) {
69
69
  * and re-faults them on the carve memsets. */
70
70
  const int N_CYCLE = 20000;
71
71
  const int CYCLE_CHILDREN = 1024;
72
+ /* Methodology (#2054, corrected 2026-11-20): the recycle layers
73
+ * (pool-block/page park-pop, arena span retain, mutation block
74
+ * caches, extension recycling) are ADAPTIVE - their limits grow
75
+ * on demand, so the first few thousand cycles pay warm-up while
76
+ * a cached-block steady state NEVER calls malloc (verified: an
77
+ * LD_PRELOAD counter shows zero malloc/free across the whole
78
+ * warmed run). A cold single block measures allocator warm-up,
79
+ * not mutation cost. Warm 5k cycles first, then min-of-3 - the
80
+ * same discipline the attr rows use. pugixml has no cross-doc
81
+ * cache, so its number is unchanged by the warm-up. */
72
82
  {
73
- double t0 = now_ns();
74
- for (int i = 0; i < N_CYCLE; i++) {
83
+ for (int i = 0; i < 5000; i++) {
75
84
  LeptrisDocument d = leptris_document_create();
76
85
  LeptrisElement root = leptris_element_create(d, "root");
77
86
  leptris_document_set_root(d, root);
@@ -81,21 +90,40 @@ int main(void) {
81
90
  }
82
91
  leptris_document_free(d);
83
92
  }
84
- double t1 = now_ns();
85
- printf("mutcycle leptris: %7.1f ns/child\n",
86
- (t1 - t0) / ((double)N_CYCLE * CYCLE_CHILDREN));
93
+ double best = 1e18;
94
+ for (int rep = 0; rep < 3; rep++) {
95
+ double t0 = now_ns();
96
+ for (int i = 0; i < N_CYCLE; i++) {
97
+ LeptrisDocument d = leptris_document_create();
98
+ LeptrisElement root = leptris_element_create(d, "root");
99
+ leptris_document_set_root(d, root);
100
+ for (int c = 0; c < CYCLE_CHILDREN; c++) {
101
+ LeptrisElement e = leptris_element_create(d, "c");
102
+ leptris_element_append_child(root, e);
103
+ }
104
+ leptris_document_free(d);
105
+ }
106
+ double t1 = now_ns();
107
+ double v = (t1 - t0) / ((double)N_CYCLE * CYCLE_CHILDREN);
108
+ if (v < best) best = v;
109
+ }
110
+ printf("mutcycle leptris: %7.1f ns/child\n", best);
87
111
  }
88
112
  {
89
- double t0 = now_ns();
90
- for (int i = 0; i < N_CYCLE; i++) {
91
- pugi::xml_document d;
92
- pugi::xml_node root = d.append_child("root");
93
- for (int c = 0; c < CYCLE_CHILDREN; c++)
94
- root.append_child("c");
113
+ double best = 1e18;
114
+ for (int rep = 0; rep < 3; rep++) {
115
+ double t0 = now_ns();
116
+ for (int i = 0; i < N_CYCLE; i++) {
117
+ pugi::xml_document d;
118
+ pugi::xml_node root = d.append_child("root");
119
+ for (int c = 0; c < CYCLE_CHILDREN; c++)
120
+ root.append_child("c");
121
+ }
122
+ double t1 = now_ns();
123
+ double v = (t1 - t0) / ((double)N_CYCLE * CYCLE_CHILDREN);
124
+ if (v < best) best = v;
95
125
  }
96
- double t1 = now_ns();
97
- printf("mutcycle pugixml: %7.1f ns/child\n",
98
- (t1 - t0) / ((double)N_CYCLE * CYCLE_CHILDREN));
126
+ printf("mutcycle pugixml: %7.1f ns/child\n", best);
99
127
  }
100
128
 
101
129
  /* ---- attr-parse: parse 20k docs, 4 elems x 16 attrs ---- */
@@ -14,6 +14,7 @@
14
14
  #include "../leptris_internal.h"
15
15
  #include "../dom/element.h"
16
16
  #include "../dom/text.h"
17
+ #include "../dom/edges.h"
17
18
  #include "../dom/comment.h"
18
19
  #include "../dom/doctype.h"
19
20
  #include "../dom/root_doc_map.h"
@@ -3948,6 +3949,71 @@ static int h_id_table_ctx(uint8_t id) {
3948
3949
  id == h_id_thead || id == h_id_tfoot || id == h_id_tr;
3949
3950
  }
3950
3951
 
3952
+ /* Unlink n from EVERY chain that currently holds it. A fostered node
3953
+ * was just appended into the table subtree: splicing it before the
3954
+ * table without removing those links left it reachable from two
3955
+ * chains at once, and the sibling walk could loop back into the
3956
+ * nodes it came from - the whole tree walker (count, serialize)
3957
+ * circled a handful of nodes hundreds of millions of times (#2096).
3958
+ * The open stack bounds the search; repeat until no chain holds the
3959
+ * node, so a previously double-linked node heals too. */
3960
+ static void h_chain_unlink(HBuilder* b, LeptrisNodeRef n) {
3961
+ if (!n) return;
3962
+ int found = 1;
3963
+ while (found) {
3964
+ found = 0;
3965
+ for (size_t i = b->depth; i-- > 0;) {
3966
+ LeptrisElement p = b->open[i];
3967
+ LeptrisNodeRef first = leptris_node_first_child_internal(
3968
+ (LeptrisNode*)p);
3969
+ if (first == n) {
3970
+ leptris_elem_set_first_child(
3971
+ p, leptris_node_get_next_sibling(n));
3972
+ if (leptris_node_get_type(n) ==
3973
+ LEPTRIS_NODE_TYPE_ELEMENT)
3974
+ p->child_count--;
3975
+ found = 1;
3976
+ break;
3977
+ }
3978
+ LeptrisNodeRef prev = first;
3979
+ while (prev) {
3980
+ LeptrisNodeRef nx =
3981
+ leptris_node_get_next_sibling(prev);
3982
+ if (nx == n) {
3983
+ leptris_node_set_next_sibling(
3984
+ prev, leptris_node_get_next_sibling(n));
3985
+ if (leptris_node_get_type(n) ==
3986
+ LEPTRIS_NODE_TYPE_ELEMENT)
3987
+ p->child_count--;
3988
+ found = 1;
3989
+ break;
3990
+ }
3991
+ prev = nx;
3992
+ }
3993
+ if (found) break;
3994
+ }
3995
+ if (!found && b->top_head) {
3996
+ if (b->top_head == n) {
3997
+ b->top_head = leptris_node_get_next_sibling(n);
3998
+ found = 1;
3999
+ } else {
4000
+ LeptrisNodeRef prev = b->top_head;
4001
+ while (prev) {
4002
+ LeptrisNodeRef nx =
4003
+ leptris_node_get_next_sibling(prev);
4004
+ if (nx == n) {
4005
+ leptris_node_set_next_sibling(
4006
+ prev, leptris_node_get_next_sibling(n));
4007
+ found = 1;
4008
+ break;
4009
+ }
4010
+ prev = nx;
4011
+ }
4012
+ }
4013
+ }
4014
+ }
4015
+ }
4016
+
3951
4017
  /* Insert n into parent's child chain BEFORE `before`. Same surgery
3952
4018
  * pattern as the head-content lift (first_child + sibling links +
3953
4019
  * element child_count). */
@@ -3972,8 +4038,12 @@ static void h_insert_before(HBuilder* b, LeptrisElement parent,
3972
4038
  }
3973
4039
  }
3974
4040
  leptris_node_set_next_sibling(n, (LeptrisNodeRef)before);
3975
- if (leptris_node_get_type(n) == LEPTRIS_NODE_TYPE_ELEMENT)
4041
+ if (leptris_node_get_type(n) == LEPTRIS_NODE_TYPE_ELEMENT) {
3976
4042
  parent->child_count++;
4043
+ leptris_elem_set_parent((LeptrisElement)n, parent);
4044
+ } else if (leptris_node_get_type(n) == LEPTRIS_NODE_TYPE_TEXT) {
4045
+ leptris_textnode_set_parent((LeptrisTextNode*)n, parent);
4046
+ }
3977
4047
  }
3978
4048
 
3979
4049
  /* O(1) append for open-stack parents (#1225): route through the
@@ -4276,6 +4346,7 @@ static void h_append(HBuilder* b, LeptrisNodeRef n) {
4276
4346
  }
4277
4347
  if (oi >= 0) {
4278
4348
  LeptrisElement tc = b->open[oi];
4349
+ h_chain_unlink(b, n);
4279
4350
  LeptrisNodeRef nxt =
4280
4351
  leptris_node_get_next_sibling(
4281
4352
  (LeptrisNodeRef)tc);
@@ -4300,6 +4371,18 @@ static void h_append(HBuilder* b, LeptrisNodeRef n) {
4300
4371
  leptris_node_set_next_sibling(
4301
4372
  (LeptrisNodeRef)tc, n);
4302
4373
  }
4374
+ {
4375
+ LeptrisElement npar = leptris_node_parent_inline(
4376
+ (LeptrisNode*)tc);
4377
+ if (leptris_node_get_type(n) ==
4378
+ LEPTRIS_NODE_TYPE_ELEMENT)
4379
+ leptris_elem_set_parent(
4380
+ (LeptrisElement)n, npar);
4381
+ else if (leptris_node_get_type(n) ==
4382
+ LEPTRIS_NODE_TYPE_TEXT)
4383
+ leptris_textnode_set_parent(
4384
+ (LeptrisTextNode*)n, npar);
4385
+ }
4303
4386
  b->depth = (size_t)oi;
4304
4387
  return;
4305
4388
  }
@@ -4307,6 +4390,7 @@ static void h_append(HBuilder* b, LeptrisNodeRef n) {
4307
4390
  if (ti >= 1) {
4308
4391
  LeptrisElement table = b->open[ti];
4309
4392
  LeptrisElement tparent = b->open[ti - 1];
4393
+ h_chain_unlink(b, n);
4310
4394
  h_insert_before(b, tparent, table, n);
4311
4395
  return;
4312
4396
  }
@@ -4314,6 +4398,7 @@ static void h_append(HBuilder* b, LeptrisNodeRef n) {
4314
4398
  /* Table sits directly on the top chain — splice n
4315
4399
  * into the chain BEFORE the table node. */
4316
4400
  LeptrisElement table = b->open[0];
4401
+ h_chain_unlink(b, n);
4317
4402
  if (b->top_head == (LeptrisNodeRef)table) {
4318
4403
  leptris_node_set_next_sibling(
4319
4404
  n, b->top_head);
@@ -4332,6 +4417,12 @@ static void h_append(HBuilder* b, LeptrisNodeRef n) {
4332
4417
  n, (LeptrisNodeRef)table);
4333
4418
  }
4334
4419
  }
4420
+ if (leptris_node_get_type(n) == LEPTRIS_NODE_TYPE_ELEMENT)
4421
+ leptris_elem_set_parent((LeptrisElement)n, NULL);
4422
+ else if (leptris_node_get_type(n) ==
4423
+ LEPTRIS_NODE_TYPE_TEXT)
4424
+ leptris_textnode_set_parent((LeptrisTextNode*)n,
4425
+ NULL);
4335
4426
  return;
4336
4427
  }
4337
4428
  }
@@ -85,6 +85,39 @@ struct pool_recycle_list {
85
85
  static LEPTRIS_THREAD_LOCAL struct pool_recycle_list t_recycle_pools;
86
86
  static LEPTRIS_THREAD_LOCAL struct pool_recycle_list t_recycle_pages;
87
87
 
88
+ /* ASAN: recycling hides use-after-free (a freed-then-parked block
89
+ * stays valid); the retain pool stands down for the same reason
90
+ * (arena.c's ARENA_RETAIN_ASAN). */
91
+ #if defined(__has_feature)
92
+ #if __has_feature(address_sanitizer)
93
+ #define POOL_RECYCLE_ASAN 1
94
+ #endif
95
+ #elif defined(__SANITIZE_ADDRESS__)
96
+ #define POOL_RECYCLE_ASAN 1
97
+ #endif
98
+
99
+ /* Arena-extension blocks (#2054's mut-doc-cycle row): a mutation
100
+ * document that outgrows its 64KB span pays one malloc per oversized
101
+ * request, and pool_destroy's arena path freed each block straight
102
+ * back to malloc - a create/build/free cycle re-mallocs and
103
+ * re-faults hundreds of same-size blocks. Park them on a capped
104
+ * thread-local list at destroy, pop an exact-size match on the next
105
+ * extension: same uninitialized-memory contract as malloc, pages
106
+ * stay warm. Stands down under custom allocators (with the pages
107
+ * list) and ASAN. */
108
+ #ifndef POOL_RECYCLE_ASAN
109
+ static LEPTRIS_THREAD_LOCAL struct pool_recycle_list t_recycle_exts;
110
+ /* Park a block only if worth it: beyond this size one malloc's
111
+ * bookkeeping is noise against the copy/fault cost, and a huge
112
+ * parked block is RSS held hostage by one outlier document. Below
113
+ * sizeof(pool_parked) parking is impossible — the list header is
114
+ * written INTO the block, so a smaller block would overflow its own
115
+ * allocation (the Windows heap-corruption 0xc0000374 the windows
116
+ * lane caught on #2105). */
117
+ #define POOL_EXT_PARK_MAX_BYTES (256u * 1024u)
118
+ #define POOL_EXT_PARK_MIN_BYTES (sizeof(struct pool_parked))
119
+ #endif
120
+
88
121
  static int pool_recycle_active(void) {
89
122
  return !leptris_custom_allocator_active();
90
123
  }
@@ -92,8 +125,14 @@ static int pool_recycle_active(void) {
92
125
  /* leptris_thread_cleanup: return every parked block to the
93
126
  * allocator so a finishing thread holds no pool memory. */
94
127
  void leptris_pool_drain_recycler(void) {
128
+ #ifndef POOL_RECYCLE_ASAN
129
+ struct pool_recycle_list* lists[3] = {&t_recycle_pools, &t_recycle_pages,
130
+ &t_recycle_exts};
131
+ for (int i = 0; i < 3; i++) {
132
+ #else
95
133
  struct pool_recycle_list* lists[2] = {&t_recycle_pools, &t_recycle_pages};
96
134
  for (int i = 0; i < 2; i++) {
135
+ #endif
97
136
  struct pool_parked* p = lists[i]->head;
98
137
  while (p) {
99
138
  struct pool_parked* next = p->next;
@@ -375,10 +414,21 @@ void leptris_pool_destroy(LeptrisMemoryPool* pool) {
375
414
  * tracked extension blocks — free those, then the arena (when
376
415
  * owned) and the pool struct. */
377
416
  if (pool->arena) {
417
+ const int can_recycle_ext = pool_recycle_active() &&
418
+ !pool->alloc_hook && !pool->dealloc_hook;
378
419
  LeptrisBigAlloc* big = pool->first_big_alloc;
379
420
  while (big) {
380
421
  LeptrisBigAlloc* next = big->next;
381
- leptris_free_hook(big->ptr);
422
+ #ifndef POOL_RECYCLE_ASAN
423
+ size_t esize = ALIGN_SIZE(big->size);
424
+ if (!can_recycle_ext ||
425
+ esize > POOL_EXT_PARK_MAX_BYTES ||
426
+ esize < POOL_EXT_PARK_MIN_BYTES ||
427
+ !pool_recycle_park(&t_recycle_exts, big->ptr, esize))
428
+ #endif
429
+ {
430
+ leptris_free_hook(big->ptr);
431
+ }
382
432
  leptris_free_hook(big);
383
433
  big = next;
384
434
  }
@@ -503,7 +553,18 @@ static void* pool_alloc_oversized(LeptrisMemoryPool* pool, size_t size) {
503
553
  * directly (NOT a recursive pool_alloc) so a near-full arena can't
504
554
  * loop. Freed by leptris_pool_destroy via the big-alloc list. */
505
555
  static void* pool_alloc_arena_extension(LeptrisMemoryPool* pool, size_t size) {
506
- void* ptr = leptris_alloc_hook(ALIGN_SIZE(size));
556
+ size_t asize = ALIGN_SIZE(size);
557
+ void* ptr = NULL;
558
+ #ifndef POOL_RECYCLE_ASAN
559
+ /* A recycled block serves the request, but it must STILL get a
560
+ * tracking node on THIS pool's big-alloc list: pool_contains and
561
+ * the destroy walk only know claimed blocks, and an unclaimed
562
+ * recycled block leaks at destroy and reads as not-pool-owned
563
+ * (the AdoptedAttrs boundary sweep caught both). */
564
+ if (pool_recycle_active())
565
+ ptr = pool_recycle_pop(&t_recycle_exts, asize);
566
+ #endif
567
+ if (!ptr) ptr = leptris_alloc_hook(asize);
507
568
  if (!ptr) return NULL;
508
569
  LeptrisBigAlloc* node =
509
570
  (LeptrisBigAlloc*)leptris_alloc_hook(sizeof(LeptrisBigAlloc));
@@ -512,7 +573,12 @@ static void* pool_alloc_arena_extension(LeptrisMemoryPool* pool, size_t size) {
512
573
  return NULL;
513
574
  }
514
575
  node->ptr = ptr;
515
- node->size = size;
576
+ /* The BLOCK is asize bytes (aligned, and recycled blocks come
577
+ * back at their aligned length): the tracking node must claim
578
+ * the true length or leptris_pool_contains leaves the alignment
579
+ * tail unclaimed and attributes living there read as
580
+ * not-pool-owned (the AdoptedAttrs boundary sweep caught it). */
581
+ node->size = asize;
516
582
  node->next = NULL;
517
583
  *pool->last_big_alloc_link = node;
518
584
  pool->last_big_alloc_link = &node->next;
@@ -15,6 +15,10 @@
15
15
  #ifndef LEPTRIS_MEMORY_POOL_H
16
16
  #define LEPTRIS_MEMORY_POOL_H
17
17
 
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
18
22
  #include <stddef.h>
19
23
  #include <stdint.h>
20
24
  #include "../../include/leptris/types.h" /* Allocator hook typedefs + opaque types */
@@ -442,4 +446,8 @@ void leptris_hash_table_for_each(StringHashTable* table,
442
446
  LeptrisHashTableIterator iter,
443
447
  void* user_data);
444
448
 
449
+ #ifdef __cplusplus
450
+ }
451
+ #endif
452
+
445
453
  #endif /* LEPTRIS_MEMORY_POOL_H */
@@ -1108,19 +1108,89 @@ static int content_allows_text(RngGrammar* g, RngPattern* content,
1108
1108
  return 0;
1109
1109
  }
1110
1110
 
1111
- static int has_element_patterns(RngPattern* content) {
1111
+ /* Does the content model contain ELEMENT patterns anywhere? The
1112
+ * wrapper kinds must not answer this by themselves: an
1113
+ * <optional> around an ATTRIBUTE beside a <data> leaf is still a
1114
+ * TEXT-content model, and treating the wrapper as element-ish
1115
+ * routed such shapes to the element-content branch where the data
1116
+ * leaf never saw the text - every datatype lexed garbage-valid
1117
+ * (#2080's beside-attribute shape). Descend through wrappers and
1118
+ * refs; unknown content (external refs, depth cap) answers
1119
+ * permissively so the element branch keeps handling it. */
1120
+ static int has_element_patterns_deep(RngGrammar* g, RngPattern* content,
1121
+ int depth, int* saw_leaf) {
1122
+ if (depth > 32) return 1;
1112
1123
  for (RngPattern* c = content; c; c = c->next) {
1113
1124
  switch (c->kind) {
1114
- case RNG_ELEMENT: case RNG_REF: case RNG_GROUP:
1115
- case RNG_INTERLEAVE: case RNG_CHOICE: case RNG_OPTIONAL:
1116
- case RNG_ZERO_OR_MORE: case RNG_ONE_OR_MORE: case RNG_MIXED:
1125
+ case RNG_ELEMENT:
1117
1126
  return 1;
1118
- default: break;
1127
+ case RNG_TEXT: case RNG_DATA: case RNG_VALUE:
1128
+ case RNG_LIST: case RNG_EMPTY:
1129
+ /* A non-attribute leaf pattern: the shape is a
1130
+ * TEXT-content model — the data leaf must actually
1131
+ * see the text (#2080's beside-attribute shape lexed
1132
+ * garbage-valid when a wrapper routed it to the
1133
+ * element branch instead). */
1134
+ *saw_leaf = 1;
1135
+ continue;
1136
+ case RNG_ATTRIBUTE: case RNG_NOT_ALLOWED:
1137
+ continue;
1138
+ case RNG_REF: {
1139
+ /* Descend for element patterns, but do NOT propagate
1140
+ * the leaf mark: leaves behind a ref (ref -> text, the
1141
+ * externalRef-splice shape) are matched by match_seq's
1142
+ * ref expansion in the element branch - the text
1143
+ * branch's leaf loop cannot resolve refs, and routing
1144
+ * such content there failed every spliced text
1145
+ * element (the v188 lockstep caught it). */
1146
+ int sub_leaf = 0;
1147
+ RngDefine* d = find_define(g, c->name);
1148
+ if (d && d->body &&
1149
+ has_element_patterns_deep(g, d->body, depth + 1,
1150
+ &sub_leaf))
1151
+ return 1;
1152
+ continue;
1153
+ }
1154
+ case RNG_CHOICE: {
1155
+ /* A choice of attribute branches is not text content:
1156
+ * the whole-branch selection machinery (#2079) lives in
1157
+ * the element-content branch — reclassifying it as a
1158
+ * text leaf let attributes from different branches
1159
+ * combine again. */
1160
+ for (RngPattern* b = c->first_child; b; b = b->next)
1161
+ if (b->kind == RNG_ATTRIBUTE) return 1;
1162
+ if (c->first_child &&
1163
+ has_element_patterns_deep(g, c->first_child,
1164
+ depth + 1, saw_leaf))
1165
+ return 1;
1166
+ continue;
1167
+ }
1168
+ case RNG_EXTERNAL_REF:
1169
+ return 1;
1170
+ default:
1171
+ if (c->first_child &&
1172
+ has_element_patterns_deep(g, c->first_child,
1173
+ depth + 1, saw_leaf))
1174
+ return 1;
1175
+ continue;
1119
1176
  }
1120
1177
  }
1121
1178
  return 0;
1122
1179
  }
1123
1180
 
1181
+ static int has_element_patterns(RngVal* v, RngPattern* content) {
1182
+ int saw_leaf = 0;
1183
+ if (has_element_patterns_deep(v->g, content, 0, &saw_leaf))
1184
+ return 1;
1185
+ /* No element patterns: the TEXT branch handles text leaves
1186
+ * (data/value/text) and empty. But content with NO leaves at
1187
+ * all — attribute-only defines, bare refs to them — belongs to
1188
+ * the element branch, which walks attributes and the zero-child
1189
+ * checks (#1709's attribute-choice-with-text shape rejected
1190
+ * everything when routed to the text branch). */
1191
+ return !saw_leaf;
1192
+ }
1193
+
1124
1194
  /* <list>: the element text tokenizes on whitespace; every token
1125
1195
  * must match the child leaves (data/value), with oneOrMore/etc.
1126
1196
  * inside handled as at-least-one-token. */
@@ -1249,7 +1319,7 @@ static int element_ok(RngVal* v, RngPattern* p, LeptrisElement e) {
1249
1319
  }
1250
1320
  if (!match_attrs(v, p, e)) return 0;
1251
1321
 
1252
- if (!has_element_patterns(p->first_child)) {
1322
+ if (!has_element_patterns(v, p->first_child)) {
1253
1323
  /* Text-level content: each non-attribute child is a leaf.
1254
1324
  * No leaf at all means empty content — wildcard elements
1255
1325
  * consumed their name class at parse, so non-ws text must
@@ -2218,7 +2288,7 @@ static void diagnose_element(RngVal* v, RngPattern* p, LeptrisElement e) {
2218
2288
  if (!p || !e) return;
2219
2289
  diagnose_attrs(v, p, e);
2220
2290
 
2221
- if (!has_element_patterns(p->first_child)) {
2291
+ if (!has_element_patterns(v, p->first_child)) {
2222
2292
  /* Text-level content. */
2223
2293
  LeptrisNodeRef sub[64];
2224
2294
  size_t sn = elem_children(e, sub, 64);
@@ -288,12 +288,18 @@ int xsd_builtin_valid(const char* type, const char* v) {
288
288
  return *p == 0;
289
289
  }
290
290
  if (strcmp(type, "xs:anyURI") == 0) {
291
- /* Permissive (libxml2-compatible): no ASCII control
292
- * characters, no leading/trailing space. */
293
- if (*v && (unsigned char)v[0] <= 0x20) return 0;
291
+ /* XSD Part 2: anyURI's whiteSpace facet is collapse — trim
292
+ * before the lexical check, and the collapsed empty string
293
+ * is a legal anyURI (#1883: Jing accepts space-padded and
294
+ * whitespace-only values; the openmath CD-loading corpus
295
+ * pads CDURL elements). Interior control characters still
296
+ * reject; interior spaces stay permitted. */
297
+ while (*v == ' ' || *v == '\t' || *v == '\n' || *v == '\r')
298
+ v++;
294
299
  size_t n = strlen(v);
295
- if (n && (unsigned char)v[n - 1] <= 0x20) return 0;
296
- for (const char* p = v; *p; p++)
300
+ while (n > 0 && (unsigned char)v[n - 1] <= 0x20) n--;
301
+ if (n == 0) return 1;
302
+ for (const char* p = v; p < v + n; p++)
297
303
  if ((unsigned char)*p < 0x20) return 0;
298
304
  return 1;
299
305
  }
@@ -205,6 +205,7 @@ if(LEPTRIS_ENABLE_DUCET)
205
205
  endif()
206
206
  leptris_add_test(test_xquery xquery/test_xquery.cpp)
207
207
  leptris_add_test(test_html html/test_html.cpp)
208
+ leptris_add_test(test_html_amp html/test_html_amplification.cpp)
208
209
  leptris_add_test(test_html_parse_errors html/test_html_parse_errors.cpp)
209
210
  leptris_add_test(test_html_builder html/test_html_builder.cpp)
210
211
  leptris_add_test(test_html_borrowed_names html/test_html_borrowed_names.cpp)
@@ -0,0 +1,78 @@
1
+ #include <gtest/gtest.h>
2
+
3
+ #include "leptris.h"
4
+ #include "leptris/html.h"
5
+
6
+ #include <cstring>
7
+ #include <cstddef>
8
+
9
+ namespace {
10
+
11
+ /* A visited-set walk: the foster splice once built chains whose
12
+ * sibling links looped back into themselves — every walker (count,
13
+ * serialize) circled forever and the "amplification" was really an
14
+ * 8-node cycle walked hundreds of millions of times. */
15
+ struct Seen {
16
+ const void* slot[4096];
17
+ };
18
+ bool seen_add(Seen& s, const void* p) {
19
+ size_t h = (reinterpret_cast<size_t>(p) >> 4) % 4096;
20
+ for (size_t i = 0; i < 4096; i++) {
21
+ size_t j = (h + i) % 4096;
22
+ if (!s.slot[j]) { s.slot[j] = p; return true; }
23
+ if (s.slot[j] == p) return false;
24
+ }
25
+ return true;
26
+ }
27
+ bool walk_tree(LeptrisNodeRef n, Seen& s, size_t& out) {
28
+ if (!n) return true;
29
+ if (!seen_add(s, n)) return false;
30
+ if (leptris_node_get_type(n) == LEPTRIS_NODE_TYPE_ELEMENT) out++;
31
+ for (LeptrisNodeRef c = leptris_node_first_child(n); c;
32
+ c = leptris_node_next_sibling(c))
33
+ if (!walk_tree(c, s, out)) return false;
34
+ return true;
35
+ }
36
+
37
+ } // namespace
38
+
39
+ /* leptris#2096: 682 bytes of malformed MathML-foreign content used to
40
+ * build a 99-million-element tree (hundreds of MB): each NUL-driven
41
+ * character run in the table context reconstructed the dangling
42
+ * active-formatting list, re-opening a full clone chain per run, while
43
+ * the foster path moved the clones out of the table and the next run
44
+ * repeated the cycle. Per WHATWG 13.2.6.4.9 the fostered token is
45
+ * processed under the in-body CHARACTER rules - characters never
46
+ * reconstruct. The tree must stay bounded. */
47
+ TEST(HtmlTreeAmplification, ReconstructionNestStaysBounded) {
48
+ static const char hto[] =
49
+ "<html><body><div >ocet<isn class=""\x22""x""\x22""5<math style=""\x22""color:red""\x22"
50
+ " disabled =""\x22""\x22""><mn style=""\x22""color:remn style=""\x22""color:redtml><b"
51
+ "\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00"
52
+ "\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00"
53
+ "\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00"
54
+ "\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00"
55
+ "\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00"
56
+ "\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""\x00""ody><div ><section class=""\x22""x"
57
+ "\x22""><math style=""\x22""color:red""\x22"" disabled =""\x22""\x22""><mn style=""\x22"
58
+ "color:red""\x22"" =""\x22""\x22"" />><mn class=""\x22""x""\x22"" =""\x22""\x22"
59
+ " />><![CDATA[x]]></math><table><math DATA-UPER=dl0 /><mo id=noquotes><![CDATA[x]]></math></table></section><table>a < b</table>dtml><body><div ><section class="
60
+ "\x22""x""\x22""><math style=""\x22""color:red""\x22"" disabled =""\x22""\x22""><mn style="
61
+ "\x22""colorz:red""\x22"" =""\x22""\x22"" />><mn class=""\x22""x""\x22"" =""\x22""\x22"
62
+ " />><![CDATA[x]]></math><table><maid=noquotes><![CDATA[x]u""\x00"
63
+ "</math></table></section><table>a < b</table>1/dv>i</b""\x00""\x00""\x00""3ody>"
64
+ ;
65
+ size_t len = sizeof(hto) - 1;
66
+ ASSERT_EQ(len, 682u) << "the pinned #2096 corpus input";
67
+ LeptrisStatus st = LEPTRIS_OK;
68
+ LeptrisDocument d = leptris_parse_html_string(hto, len, &st);
69
+ ASSERT_NE(d, nullptr);
70
+ Seen s;
71
+ memset(&s, 0, sizeof(s));
72
+ size_t n = 0;
73
+ LeptrisNodeRef root = (LeptrisNodeRef)leptris_document_root(d);
74
+ ASSERT_TRUE(walk_tree(root, s, n))
75
+ << "the foster splice must never link a node into a cycle";
76
+ leptris_document_free(d);
77
+ EXPECT_LT(n, 1000u) << "the tree must stay bounded for this input";
78
+ }
@@ -41,8 +41,7 @@ TEST(MutRecycle, ParksBlocksAfterDocCycle) {
41
41
  /* Drain: leptris_explicit_cleanup (public, opt-in) must free every
42
42
  * parked block — the LSan-clean escape hatch for embedders and tests.
43
43
  * Falsified if the lists keep blocks (counter > 0) after the call. */
44
- TEST(MutRecycle, ExplicitCleanupDrainsAllKinds) {
45
- leptris_explicit_cleanup();
44
+ TEST(MutRecycle, ExplicitCleanupDrainsAllKinds) { leptris_explicit_cleanup();
46
45
  run_doc_cycle(4);
47
46
  ASSERT_GT(leptris_mut_recycle_cached_bytes(), 0u);
48
47
  leptris_explicit_cleanup();
@@ -62,3 +61,30 @@ TEST(MutRecycle, SteadyStateRespectsByteCaps) {
62
61
  leptris_explicit_cleanup();
63
62
  EXPECT_EQ(leptris_mut_recycle_cached_bytes(), 0u);
64
63
  }
64
+
65
+ /* The pool's arena-EXTENSION recycler (pool.c t_recycle_exts) parks
66
+ * blocks by writing a list header INTO the block's first bytes — a
67
+ * block smaller than that header would overflow its own allocation
68
+ * (the Windows heap-corruption 0xc0000374 that caught #2105). Drive
69
+ * tiny arena extensions: overflow a mutation document's span with
70
+ * sub-header-size pool allocations and free across many cycles.
71
+ * Falsified by any heap corruption (asan/heap nixer) or wrong data
72
+ * on the recycled block. */
73
+ TEST(MutRecycle, TinyArenaExtensionsNeverOverflowParkHeader) {
74
+ leptris_explicit_cleanup();
75
+ for (int cycle = 0; cycle < 40; cycle++) {
76
+ LeptrisDocument doc = leptris_document_create();
77
+ ASSERT_NE(doc, nullptr);
78
+ LeptrisElement root = leptris_element_create(doc, "r");
79
+ ASSERT_NE(root, nullptr);
80
+ /* Overflow the 64KB span with allocations at and below the
81
+ * park-header size so every extension lands in the tiny
82
+ * range the header cannot fit in. */
83
+ for (int i = 0; i < 20000; i++) {
84
+ void* p = leptris_pool_alloc(doc->pool, 8);
85
+ if (p) memset(p, 0xAB, 8);
86
+ }
87
+ leptris_document_free(doc);
88
+ }
89
+ leptris_explicit_cleanup();
90
+ }
@@ -2052,6 +2052,128 @@ TEST(Rng2080Data, Base64BinaryLexes) {
2052
2052
  leptris_rng_free(rng);
2053
2053
  }
2054
2054
 
2055
+ /* The #2080 residual shape: an attribute pattern (optional or
2056
+ * required) BESIDE the data leaf. has_element_patterns counted the
2057
+ * wrapper kinds as element patterns, so [optional(attr), data]
2058
+ * took the element-content branch, the data leaf never saw the
2059
+ * text, and every datatype lexed as garbage-in-garbage-valid. The
2060
+ * element-pattern question must descend through wrappers and
2061
+ * refs. */
2062
+ /* #1883's openmath CD-loading shape: a RelaxNG <data type="anyURI"/>
2063
+ * element whose content is space-padded - XSD Part 2's collapse
2064
+ * facet trims before the lexical check (Jing accepts). */
2065
+ TEST(Rng2080Data, AnyURICollapsesPaddedContent) {
2066
+ const char* schema =
2067
+ "<element name=\"CDURL\" xmlns=\"http://relaxng.org/ns/structure/1.0\""
2068
+ " datatypeLibrary=\"http://www.w3.org/2001/XMLSchema-datatypes\">"
2069
+ "<data type=\"anyURI\"/></element>";
2070
+ LeptrisRelaxNG rng =
2071
+ leptris_rng_parse(schema, strlen(schema), nullptr);
2072
+ ASSERT_NE(rng, nullptr);
2073
+ LeptrisStatus st = LEPTRIS_OK;
2074
+ struct { const char* doc; int want; const char* why; } cases[] = {
2075
+ {"<CDURL> http://www.openmath.org/cd/alg1.ocd </CDURL>", 1,
2076
+ "the openmath CDURL shape: padded URI collapses"},
2077
+ {"<CDURL> </CDURL>", 1, "whitespace-only collapses to the empty URI"},
2078
+ {"<CDURL>http://x</CDURL>", 1, "unpadded stays valid"},
2079
+ {"<CDURL>ht\ttp://x</CDURL>", 0, "an interior control character still rejects"},
2080
+ };
2081
+ for (auto& c : cases) {
2082
+ LeptrisDocument d = leptris_parse_string(c.doc, strlen(c.doc), &st);
2083
+ ASSERT_NE(d, nullptr) << c.doc;
2084
+ EXPECT_EQ(leptris_rng_validate(rng, d), c.want)
2085
+ << c.why << " — doc: " << c.doc;
2086
+ leptris_document_free(d);
2087
+ }
2088
+ leptris_rng_free(rng);
2089
+ }
2090
+
2091
+ /* The externalRef splice rides the ELEMENT branch: a ref whose
2092
+ * target body is a text leaf (the v188 externalRef-splice shape)
2093
+ * is matched by match_seq's ref expansion - routing it to the
2094
+ * text branch failed every spliced text element (the ruby v188
2095
+ * lockstep caught it on the 1.9.431 ride). */
2096
+ TEST(Rng2110RefShapes, ExternalRefTextPayloadSplicesAndValidates) {
2097
+ const char* child =
2098
+ "<grammar xmlns=\"http://relaxng.org/ns/structure/1.0\">"
2099
+ "<start><element name=\"e\"><ref name=\"payload\"/></element></start>"
2100
+ "<define name=\"payload\"><text/></define></grammar>";
2101
+ const char* host =
2102
+ "<grammar xmlns=\"http://relaxng.org/ns/structure/1.0\">"
2103
+ "<start><element name=\"r\"><externalRef href=\"child.rng\"/></element></start>"
2104
+ "</grammar>";
2105
+ LeptrisRelaxNG rng = nullptr;
2106
+ {
2107
+ LeptrisStatus st = LEPTRIS_OK;
2108
+ /* both files land in the test's cwd; the href resolves there */
2109
+ FILE* f = fopen("child.rng", "wb");
2110
+ ASSERT_NE(f, nullptr);
2111
+ fwrite(child, 1, strlen(child), f);
2112
+ fclose(f);
2113
+ f = fopen("host.rng", "wb");
2114
+ ASSERT_NE(f, nullptr);
2115
+ fwrite(host, 1, strlen(host), f);
2116
+ fclose(f);
2117
+ rng = leptris_rng_parse_file("host.rng", &st);
2118
+ ASSERT_NE(rng, nullptr) << "host parse failed: " << (int)st;
2119
+ remove("child.rng");
2120
+ remove("host.rng");
2121
+ }
2122
+ LeptrisStatus st = LEPTRIS_OK;
2123
+ struct { const char* doc; int want; const char* why; } cases[] = {
2124
+ {"<r><e>t</e></r>", 1, "the spliced text element validates"},
2125
+ {"<r><x/></r>", 0, "a wrong child still rejects"},
2126
+ };
2127
+ for (auto& c : cases) {
2128
+ LeptrisDocument d = leptris_parse_string(c.doc, strlen(c.doc), &st);
2129
+ ASSERT_NE(d, nullptr) << c.doc;
2130
+ EXPECT_EQ(leptris_rng_validate(rng, d), c.want)
2131
+ << c.why << " — doc: " << c.doc;
2132
+ leptris_document_free(d);
2133
+ }
2134
+ leptris_rng_free(rng);
2135
+ }
2136
+
2137
+ TEST(Rng2080Data, DataLexesBesideAttributePatterns) {
2138
+ const char* opt_schema =
2139
+ "<element name=\"OMB\" xmlns=\"http://relaxng.org/ns/structure/1.0\""
2140
+ " datatypeLibrary=\"http://www.w3.org/2001/XMLSchema-datatypes\">"
2141
+ "<optional><attribute name=\"id\"><data type=\"string\"/></attribute></optional>"
2142
+ "<data type=\"base64Binary\"/></element>";
2143
+ const char* req_schema =
2144
+ "<element name=\"OMB\" xmlns=\"http://relaxng.org/ns/structure/1.0\""
2145
+ " datatypeLibrary=\"http://www.w3.org/2001/XMLSchema-datatypes\">"
2146
+ "<attribute name=\"id\"><data type=\"string\"/></attribute>"
2147
+ "<data type=\"base64Binary\"/></element>";
2148
+ const char* dbl_schema =
2149
+ "<element name=\"D\" xmlns=\"http://relaxng.org/ns/structure/1.0\""
2150
+ " datatypeLibrary=\"http://www.w3.org/2001/XMLSchema-datatypes\">"
2151
+ "<optional><attribute name=\"id\"><data type=\"string\"/></attribute></optional>"
2152
+ "<data type=\"double\"/></element>";
2153
+ struct { const char* schema; const char* doc; int want; const char* why; } cases[] = {
2154
+ {opt_schema, "<OMB>not-base64!!!</OMB>", 0, "optional attr beside data: garbage base64 rejects"},
2155
+ {opt_schema, "<OMB>aGVsbG8=</OMB>", 1, "optional attr beside data: valid base64 accepts"},
2156
+ {opt_schema, "<OMB id=\"x\">not-base64!!!</OMB>", 0, "with the optional present: still lexes"},
2157
+ {req_schema, "<OMB id=\"x\">not-base64!!!</OMB>", 0, "required attr beside data: garbage rejects"},
2158
+ {req_schema, "<OMB id=\"x\">aGVsbG8=</OMB>", 1, "required attr beside data: valid accepts"},
2159
+ {req_schema, "<OMB>not-base64!!!</OMB>", 0, "missing required attr still rejects"},
2160
+ {dbl_schema, "<D>not-a-double!!!</D>", 0, "the same shape on double rejects"},
2161
+ {dbl_schema, "<D>0.5</D>", 1, "double accepts a real double"},
2162
+ };
2163
+ for (auto& c : cases) {
2164
+ LeptrisRelaxNG rng =
2165
+ leptris_rng_parse(c.schema, strlen(c.schema), nullptr);
2166
+ ASSERT_NE(rng, nullptr) << c.why;
2167
+ LeptrisStatus st = LEPTRIS_OK;
2168
+ LeptrisDocument d = leptris_parse_string(c.doc, strlen(c.doc), &st);
2169
+ ASSERT_NE(d, nullptr) << c.doc;
2170
+ EXPECT_EQ(leptris_rng_validate(rng, d), c.want)
2171
+ << c.why << " — doc: " << c.doc;
2172
+ leptris_document_free(d);
2173
+ leptris_rng_free(rng);
2174
+ }
2175
+ }
2176
+
2055
2177
  TEST(Rng2080Data, HexBinaryLexes) {
2056
2178
  const char* schema =
2057
2179
  "<element name=\"H\" xmlns=\"http://relaxng.org/ns/structure/1.0\">"
@@ -878,6 +878,28 @@ TEST(XsdDatatypes, BuiltinsLexicalMatrix) {
878
878
  }
879
879
  }
880
880
 
881
+ /* leptris#1883 (the anyURI row): XSD Part 2 gives anyURI the
882
+ * collapse whiteSpace facet - leading/trailing whitespace trims
883
+ * before the lexical check, and the collapsed empty string is a
884
+ * legal anyURI (Jing accepts space-padded and whitespace-only
885
+ * values; the openmath CD-loading corpus pads CDURL elements). */
886
+ TEST(XsdDatatypes, AnyURICollapseFacet) {
887
+ const BuiltinCase rows[] = {
888
+ {"xs:anyURI", "http://x/y", 1},
889
+ {"xs:anyURI", " http://x/y ", 1},
890
+ {"xs:anyURI", "\thttp://x\n", 1},
891
+ {"xs:anyURI", " ", 1},
892
+ {"xs:anyURI", "", 1},
893
+ {"xs:anyURI", "ht\tp://x", 0},
894
+ {"xs:anyURI", "http://x\n/y", 0},
895
+ };
896
+ for (const BuiltinCase& c : rows) {
897
+ SCOPED_TRACE(std::string(c.type) + " : " + c.value);
898
+ EXPECT_EQ(leptris_xsd_builtin_valid(c.type, c.value), c.expect)
899
+ << c.type << " : " << c.value;
900
+ }
901
+ }
902
+
881
903
  /* leptris#1936: gMonth accepts BOTH XSD 1.0 spellings — the
882
904
  * errata's --MM and the first edition's --MM-- — each with the
883
905
  * optional timezone; and the g-regional/date family rejects
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
3
3
  "name": "leptris",
4
- "version": "1.9.430",
4
+ "version": "1.9.432",
5
5
  "description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
6
6
  "homepage": "https://github.com/leptris/leptris",
7
7
  "license": "MIT",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.430.0
4
+ version: 1.9.432.1
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-20 00:00:00.000000000 Z
11
+ date: 2026-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -988,6 +988,7 @@ files:
988
988
  - vendor-src/libleptris/test/html/nokogiri-tree-tests.dat
989
989
  - vendor-src/libleptris/test/html/test_html.cpp
990
990
  - vendor-src/libleptris/test/html/test_html5lib.cpp
991
+ - vendor-src/libleptris/test/html/test_html_amplification.cpp
991
992
  - vendor-src/libleptris/test/html/test_html_borrowed_names.cpp
992
993
  - vendor-src/libleptris/test/html/test_html_builder.cpp
993
994
  - vendor-src/libleptris/test/html/test_html_parse_errors.cpp
@@ -2536,7 +2537,7 @@ metadata:
2536
2537
  homepage_uri: https://github.com/leptris/leptris-ruby
2537
2538
  source_code_uri: https://github.com/leptris/leptris-ruby
2538
2539
  changelog_uri: https://github.com/leptris/leptris-ruby/blob/main/CHANGELOG.md
2539
- post_install_message:
2540
+ post_install_message:
2540
2541
  rdoc_options: []
2541
2542
  require_paths:
2542
2543
  - lib
@@ -2552,7 +2553,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2552
2553
  version: '0'
2553
2554
  requirements: []
2554
2555
  rubygems_version: 3.5.22
2555
- signing_key:
2556
+ signing_key:
2556
2557
  specification_version: 4
2557
2558
  summary: Nokogiri-compatible Ruby binding for libleptris (XML 1.0, XPath 1.0, SAX)
2558
2559
  test_files: []