leptris 1.9.341.0-ppc64le-linux → 1.9.343.0-ppc64le-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: 1edd66e08f55f89a34eb0c7ed22ff29ea620c80b0b36a82edd83da13e83843fd
4
- data.tar.gz: 83d3b0769e869bb4122f08f3da82d74cf52482e61547520cffb8f3f797806cb3
3
+ metadata.gz: 4a0c884a926a11e8becea254f8b561e913de48156a5ba654e976d7c060b2f012
4
+ data.tar.gz: 801ec647547bc1f236683be8c947848f3641bc126aa7688f15b60fe04d2ac18d
5
5
  SHA512:
6
- metadata.gz: cb28337e4a0e572f84bcffc197da5de2652866995542e6c64894c0589523029fb4855b548e33487a7d30061ebafe4e05fdc981766932fb6cc6abedcfb144b4c8
7
- data.tar.gz: 06a1e28a3aad4d929a5b5a6157123081a37c06f09fdcb7f265fd59da901d192bc2234e041c980b61364dd7844b3b1b695a15a3b5a5fc166636babe54d5385ff7
6
+ metadata.gz: a89ac3ee0f4dcb73e4f1a656004f84b4f81d039a106409b3794435f992112ce0684d0565054e8b2e7696bc7fa7ee1505886adfdaf56569714c954f0b7a7dbe71
7
+ data.tar.gz: c1147a49139b5c8f2389f2a807bb2fbfde2502bbd2a88f5ce63e8212f11837f836f0f393e76495425a190bd772fd8cd4d4dedd6a86b963e7577e3b98b85260e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [1.9.342.0] - 2026-10-12
2
+
3
+ ### Fixed — engine sync (libleptris 1.9.342)
4
+
5
+ - **The #434 corpus lexical families (#1655)**: (1) the XSD
6
+ length family counts OCTETS for hexBinary/base64Binary (Part 2
7
+ semantics) — ST_LongHexNumber = hexBinary+length 4 = 8 hex
8
+ digits; the engine demanded 4 characters and rejected every
9
+ canonical rsid. The restriction chain's terminal builtin threads
10
+ into the facet check (hex digits/2, base64 decoded). (2) The
11
+ XSD regex matcher gains property classes (\p{IsBasicLatin} et
12
+ al.), character-class subtraction, and \t/\n/\r escapes —
13
+ ST_ContentType's giant pattern previously failed to PARSE and a
14
+ parse failure rejected everything. Verified through the binding:
15
+ octet hex semantics at the type level; the real
16
+ [Content_Types].xml validates with ZERO errors against the real
17
+ opc-contentTypes.xsd (the 339-error family is gone); document
18
+ error distributions carry no lexical families — the residual
19
+ corpus delta is the documented strict-ISO structural layer.
20
+
1
21
  ## [1.9.340.0] - 2026-10-11
2
22
 
3
23
  ### Added — engine sync (libleptris 1.9.338-1.9.340)
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.341"
11
+ LIBLEPTRIS_VERSION = "1.9.342"
12
12
  # Vendored alongside libleptris for fn:normalize-unicode (TODO
13
13
  # .restructure/20): built per platform with a RELOCATABLE @rpath
14
14
  # install name, loaded by ffi.rb before libleptris so the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.341.0"
4
+ VERSION = "1.9.343.0"
5
5
  end
@@ -48,6 +48,28 @@ module Leptris::XML::XSD
48
48
  end
49
49
  end
50
50
 
51
+ # Deterministic drop (#362.3 / moxml): frees the compiled
52
+ # schema NOW instead of waiting for GC — long-lived validation
53
+ # services holding dozens of schemas stop parking engine-side
54
+ # trees for the process lifetime. The AutoPointer's GC
55
+ # finalizer is disarmed first (autorelease=false), so the free
56
+ # happens exactly once. Faces on a released schema raise.
57
+ #
58
+ # schema = Leptris::XML::XSD.compile_file(path)
59
+ # schema.release # => true
60
+ # schema.released? # => true
61
+ def release
62
+ return true if released?
63
+ @handle.autorelease = false
64
+ Leptris::XML::FFI.leptris_xsd_free(@handle)
65
+ @released = true
66
+ true
67
+ end
68
+
69
+ def released?
70
+ instance_variable_defined?(:@released) ? @released : false
71
+ end
72
+
51
73
  # Compile a schema from XML text. Raises Error when the text is
52
74
  # not usable at all (not well-formed, no root); schema-level
53
75
  # problems compile to a handle whose #error carries the detail
@@ -82,12 +104,14 @@ module Leptris::XML::XSD
82
104
  # Number of top-level schema declarations the compiler
83
105
  # recognized (elements, types, groups, ...).
84
106
  def declaration_count
107
+ check_released!
85
108
  Leptris::XML::FFI.leptris_xsd_declaration_count(@handle)
86
109
  end
87
110
 
88
111
  # The engine's schema-level error message, or nil when the
89
112
  # schema compiled cleanly.
90
113
  def error
114
+ check_released!
91
115
  msg = Leptris::XML::FFI.leptris_xsd_error(@handle)
92
116
  msg.nil? || msg.empty? ? nil : msg
93
117
  end
@@ -97,6 +121,7 @@ module Leptris::XML::XSD
97
121
  # name) — restriction chains validate every hop's facets,
98
122
  # cycle-guarded. Unknown type names raise (the -1 contract).
99
123
  def simple_valid?(type_name, lexical)
124
+ check_released!
100
125
  tri_state(
101
126
  Leptris::XML::FFI.leptris_xsd_simple_valid(
102
127
  @handle, type_name.to_s, lexical.to_s),
@@ -109,6 +134,7 @@ module Leptris::XML::XSD
109
134
  # and child content models through the Thompson NFA. Returns
110
135
  # true/false.
111
136
  def valid?(document)
137
+ check_released!
112
138
  tri_state(
113
139
  Leptris::XML::FFI.leptris_xsd_validate(
114
140
  @handle, document.c_ptr), "invalid document handle")
@@ -117,6 +143,7 @@ module Leptris::XML::XSD
117
143
  # The enumerated failure list of the last #validate run
118
144
  # (empty when valid; the NEXT validate replaces the list).
119
145
  def validate_errors(document)
146
+ check_released!
120
147
  valid?(document)
121
148
  Leptris::XML::FFI.leptris_xsd_error_count(@handle).times.map do |i|
122
149
  Leptris::XML::FFI.leptris_xsd_error_at(@handle, i)
@@ -129,6 +156,7 @@ module Leptris::XML::XSD
129
156
  # + effective namespace extracted per child). Unknown element
130
157
  # declarations raise (the -1 contract).
131
158
  def content_valid?(element_name, children)
159
+ check_released!
132
160
  kids = children.to_a
133
161
  nb, na = Leptris::XML::CStringArray.to_c(
134
162
  kids.map { |c| c.name.to_s })
@@ -142,6 +170,11 @@ module Leptris::XML::XSD
142
170
 
143
171
  private
144
172
 
173
+ def check_released!
174
+ raise Leptris::XML::UseAfterFreeError,
175
+ "schema released (moxml #362.3)" if released?
176
+ end
177
+
145
178
  # A child's effective namespace URI (nil = none) — read
146
179
  # through its own c_ptr, so docless wrappers work.
147
180
  def child_ns_uri(node)
data/lib/libleptris.so 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.341
4
+ - libleptris v1.9.342
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,27 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.342] - 2026-10-11
4
+
5
+ ### Fixed
6
+
7
+ - **XSD lexical families: octet lengths + pattern property
8
+ classes (leptris-ruby#434, PR #1655).** Two gaps behind the
9
+ uniword corpus rejections:
10
+ (1) the length family counted CHARACTERS for every base -
11
+ XML Schema Part 2 counts OCTETS for hexBinary/base64Binary,
12
+ so the wml ST_LongHexNumber shape (length 4 = 4 bytes = 8
13
+ hex digits) rejected every canonical 8-digit rsid. The
14
+ restriction chain's terminal builtin now reaches the facet
15
+ check (hex in digits/2, base64 decoded); string-family
16
+ semantics unchanged.
17
+ (2) the OPC ST_ContentType pattern failed to PARSE - and a
18
+ parse failure rejects everything - missing XSD-regex
19
+ property classes (\p{IsBasicLatin}, \p{IsLatin-1Supplement},
20
+ \p{Cc}), character-class subtraction ([A-[B]]), and the
21
+ \t/\n/\r control escapes. Verified against the corpus's own
22
+ wml.xsd and opc-contentTypes.xsd; red-first specs for both.
23
+
24
+
3
25
  ## [1.9.341] - 2026-10-11
4
26
 
5
27
  ### Fixed
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.341
6
+ VERSION 1.9.342
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -126,6 +126,41 @@ static RreNode* parse_class(RreParser* ps) {
126
126
  int first = 1;
127
127
  while (*ps->p && (*ps->p != ']' || first)) {
128
128
  first = 0;
129
+ if (*ps->p == '\\' && ps->p[1] == 'p' && ps->p[2] == '{') {
130
+ /* XSD property classes for the Latin-1 byte world —
131
+ * the byte-class matcher covers these exactly
132
+ * (leptris-ruby#434, ST_ContentType). Other blocks
133
+ * fail loudly as before. */
134
+ ps->p += 3;
135
+ const char* close = strchr(ps->p, '}');
136
+ if (!close) {
137
+ node_free(n);
138
+ ps->bad = 1;
139
+ return NULL;
140
+ }
141
+ size_t len = (size_t)(close - ps->p);
142
+ int hit = 0;
143
+ if (len == 12 && memcmp(ps->p, "IsBasicLatin", 12) == 0) {
144
+ for (int i = 0x00; i <= 0x7F; i++) cls_add(n, (unsigned char)i);
145
+ hit = 1;
146
+ } else if (len == 19 &&
147
+ memcmp(ps->p, "IsLatin-1Supplement", 19) == 0) {
148
+ for (int i = 0x80; i <= 0xFF; i++) cls_add(n, (unsigned char)i);
149
+ hit = 1;
150
+ } else if (len == 2 && ps->p[0] == 'C' && ps->p[1] == 'c') {
151
+ for (int i = 0x00; i <= 0x1F; i++) cls_add(n, (unsigned char)i);
152
+ cls_add(n, 0x7F);
153
+ for (int i = 0x80; i <= 0x9F; i++) cls_add(n, (unsigned char)i);
154
+ hit = 1;
155
+ }
156
+ if (!hit) {
157
+ node_free(n);
158
+ ps->bad = 1;
159
+ return NULL;
160
+ }
161
+ ps->p = close + 1;
162
+ continue;
163
+ }
129
164
  if (*ps->p == '\\' && ps->p[1]) {
130
165
  ps->p++;
131
166
  char e = *ps->p++;
@@ -155,9 +190,37 @@ static RreNode* parse_class(RreParser* ps) {
155
190
  node_free(tmp);
156
191
  continue;
157
192
  }
193
+ /* XSD singleCharEsc covers the control escapes too
194
+ * (the OPC ST_ContentType pattern uses \t) —
195
+ * leptris-ruby#434. */
196
+ if (e == 't') { cls_add(n, '\t'); continue; }
197
+ if (e == 'n') { cls_add(n, '\n'); continue; }
198
+ if (e == 'r') { cls_add(n, '\r'); continue; }
158
199
  cls_add(n, (unsigned char)e);
159
200
  continue;
160
201
  }
202
+ /* XSD charClassSub: `[ A - [ B ] ]` — the '-' followed by
203
+ * '[' subtracts the bracketed class (leptris-ruby#434, the
204
+ * OPC ST_ContentType shape). The subtraction is the last
205
+ * member of the class. */
206
+ if (*ps->p == '-' && ps->p[1] == '[') {
207
+ ps->p++;
208
+ RreNode* sub = parse_class(ps);
209
+ if (!sub) {
210
+ node_free(n);
211
+ return NULL;
212
+ }
213
+ for (int i = 0; i < 256; i++)
214
+ if ((sub->cls[i >> 3] >> (i & 7)) & 1)
215
+ n->cls[i >> 3] &= (unsigned char)~(1u << (i & 7));
216
+ node_free(sub);
217
+ if (*ps->p != ']') {
218
+ node_free(n);
219
+ ps->bad = 1;
220
+ return NULL;
221
+ }
222
+ break;
223
+ }
161
224
  unsigned char c = (unsigned char)*ps->p++;
162
225
  if (*ps->p == '-' && ps->p[1] && ps->p[1] != ']') {
163
226
  ps->p++;
@@ -228,9 +291,14 @@ static RreNode* parse_atom(RreParser* ps) {
228
291
  ps->p += 2;
229
292
  RreNode* n = node_new(RRE_CHAR);
230
293
  if (!n) return NULL;
231
- /* Only punctuation may be escaped as a literal; other
232
- * escapes (XSD \p{...}, backrefs, \n...) are outside the
233
- * supported subset and must fail loudly at parse time. */
294
+ /* Only punctuation may be escaped as a literal, plus the
295
+ * XSD control escapes (the OPC ST_ContentType pattern uses
296
+ * \t) — other escapes (XSD \p{...} outside a class,
297
+ * backrefs) are outside the supported subset and must fail
298
+ * loudly at parse time (leptris-ruby#434). */
299
+ if (e == 't') { n->ch = '\t'; return n; }
300
+ if (e == 'n') { n->ch = '\n'; return n; }
301
+ if (e == 'r') { n->ch = '\r'; return n; }
234
302
  if (isalnum((unsigned char)e)) {
235
303
  free(n);
236
304
  ps->bad = 1;
@@ -16,7 +16,8 @@
16
16
 
17
17
  void xsd_capture_ics(struct leptris_xsd_schema* s,
18
18
  LeptrisElement elem, const char* element_name);
19
- extern int xsd_simple_valid(const XsdSimple* simple, const char* v);
19
+ extern int xsd_simple_valid(const XsdSimple* simple, const char* v,
20
+ const char* terminal_base);
20
21
  extern struct xsd_validator* xsd_validator_new(
21
22
  struct leptris_xsd_schema* s);
22
23
  extern void xsd_validator_free(struct xsd_validator* v);
@@ -471,6 +472,21 @@ static int xsd_item_valid(struct leptris_xsd_schema* s,
471
472
  return 1;
472
473
  }
473
474
 
475
+ /* The chain's terminal builtin (NULL = none resolved): the length
476
+ * family needs it to count octets for the binary bases
477
+ * (leptris-ruby#434). */
478
+ static const char* xsd_chain_terminal(struct leptris_xsd_schema* s,
479
+ const XsdSimple* t) {
480
+ int depth = 0;
481
+ while (t && depth < 32) {
482
+ if (!t->base) return NULL;
483
+ if (strncmp(t->base, "xs:", 3) == 0) return t->base;
484
+ t = xsd_find_simple(s, t->base);
485
+ depth++;
486
+ }
487
+ return NULL;
488
+ }
489
+
474
490
  static int xsd_deriv_valid(struct leptris_xsd_schema* s,
475
491
  const XsdSimple* t, const char* v,
476
492
  int depth) {
@@ -512,7 +528,7 @@ static int xsd_deriv_valid(struct leptris_xsd_schema* s,
512
528
  return 1;
513
529
  return 0;
514
530
  }
515
- return xsd_simple_valid(t, v);
531
+ return xsd_simple_valid(t, v, xsd_chain_terminal(s, t));
516
532
  }
517
533
 
518
534
  static int xsd_valid_chain(struct leptris_xsd_schema* s,
@@ -524,7 +540,7 @@ static int xsd_valid_chain(struct leptris_xsd_schema* s,
524
540
  }
525
541
  if (t->deriv != XSD_SIMPLE_RESTRICT)
526
542
  return xsd_deriv_valid(s, t, v, depth);
527
- return xsd_simple_valid(t, v);
543
+ return xsd_simple_valid(t, v, xsd_chain_terminal(s, t));
528
544
  }
529
545
 
530
546
  static void xsd_set_error(struct leptris_xsd_schema* s, const char* msg) {
@@ -375,7 +375,8 @@ int xsd_builtin_valid(const char* type, const char* v) {
375
375
 
376
376
  /* ---- facet checking on a captured simpleType --------------------- */
377
377
 
378
- int xsd_simple_valid(const XsdSimple* simple, const char* v);
378
+ int xsd_simple_valid(const XsdSimple* simple, const char* v,
379
+ const char* terminal_base);
379
380
 
380
381
  /* The base chain resolves to a built-in reference: validate the
381
382
  * lexical against it first. */
@@ -385,7 +386,8 @@ static int base_valid(const char* base, const char* v) {
385
386
  return -1; /* local base — the resolver walks the chain */
386
387
  }
387
388
 
388
- static int facet_check(const XsdSimple* s, const char* v) {
389
+ static int facet_check(const XsdSimple* s, const char* v,
390
+ const char* terminal_base) {
389
391
  if (s->pattern && !rng_regex_matches(s->pattern, v)) return 0;
390
392
  if (s->enum_values) {
391
393
  int found = 0;
@@ -393,8 +395,27 @@ static int facet_check(const XsdSimple* s, const char* v) {
393
395
  if (strcmp(e->text, v) == 0) { found = 1; break; }
394
396
  if (!found) return 0;
395
397
  }
396
- /* Length family: character count (string-family semantics). */
398
+ /* Length family: character count (string-family semantics) —
399
+ * except the binary types, where XML Schema Part 2 counts
400
+ * OCTETS (the wml ST_LongHexNumber shape: hexBinary + length 4
401
+ * accepts 8 hex digits; leptris-ruby#434). */
397
402
  size_t n = strlen(v);
403
+ if (terminal_base && (strcmp(terminal_base, "xs:hexBinary") == 0 ||
404
+ strcmp(terminal_base, "xs:base64Binary") == 0)) {
405
+ if (strcmp(terminal_base, "xs:hexBinary") == 0) {
406
+ n = n / 2;
407
+ } else {
408
+ size_t pads = 0;
409
+ while (n > 0 && v[n - 1] == '=') {
410
+ pads++;
411
+ n--;
412
+ }
413
+ size_t octets = (n / 4) * 3;
414
+ if (n % 4 == 2) octets += 1;
415
+ else if (n % 4 == 3) octets += 2;
416
+ n = octets;
417
+ }
418
+ }
398
419
  if (s->length >= 0 && (long)n != s->length) return 0;
399
420
  if (s->min_length >= 0 && (long)n < s->min_length) return 0;
400
421
  if (s->max_length >= 0 && (long)n > s->max_length) return 0;
@@ -429,13 +450,14 @@ static int facet_check(const XsdSimple* s, const char* v) {
429
450
  return 1;
430
451
  }
431
452
 
432
- int xsd_simple_valid(const XsdSimple* simple, const char* v) {
453
+ int xsd_simple_valid(const XsdSimple* simple, const char* v,
454
+ const char* terminal_base) {
433
455
  if (!simple || !v) return 0;
434
456
  int base = base_valid(simple->base, v);
435
457
  if (base == 0) return 0;
436
458
  /* base == -1 (local base) delegates to the resolver's chain in
437
459
  * the caller; facets still apply here. */
438
- return facet_check(simple, v);
460
+ return facet_check(simple, v, terminal_base);
439
461
  }
440
462
 
441
463
  /* Pattern/enumeration defaults for whitespace — slice 3 grows the
@@ -167,6 +167,84 @@ TEST(XsdCompile, ImportDagCapturesEachUnitOnce) {
167
167
  leptris_xsd_free(s);
168
168
  }
169
169
 
170
+ // leptris-ruby#434: the length family counts OCTETS for binary
171
+ // bases (XML Schema Part 2: hexBinary/base64Binary length is in
172
+ // bytes) — the wml ST_LongHexNumber shape (hexBinary + length 4)
173
+ // rejected every canonical 8-digit rsid.
174
+ TEST(XsdDatatypes, LengthFacetCountsOctetsForHexBinary) {
175
+ const char xsd[] =
176
+ "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
177
+ "<xs:simpleType name=\"ST_LongHexNumber\">"
178
+ "<xs:restriction base=\"xs:hexBinary\">"
179
+ "<xs:length value=\"4\"/></xs:restriction>"
180
+ "</xs:simpleType>"
181
+ "<xs:simpleType name=\"ST_Range\">"
182
+ "<xs:restriction base=\"xs:hexBinary\">"
183
+ "<xs:minLength value=\"1\"/><xs:maxLength value=\"4\"/>"
184
+ "</xs:restriction>"
185
+ "</xs:simpleType></xs:schema>";
186
+ LeptrisStatus st = LEPTRIS_OK;
187
+ LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
188
+ ASSERT_EQ(st, LEPTRIS_OK);
189
+ ASSERT_NE(s, (LeptrisXsdSchema)0);
190
+ // 8 hex digits = 4 octets
191
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_LongHexNumber", "00A1B2C3"), 1);
192
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_LongHexNumber", "00A1B2C3FF"), 0);
193
+ // 4 hex digits = 2 octets
194
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_LongHexNumber", "00A1"), 0);
195
+ // min/max in octets: 2..8 hex digits
196
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "00A1"), 1);
197
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "00A1B2C3"), 1);
198
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "0"), 0);
199
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "00A1B2C3FF"), 0);
200
+ // string-family length stays in characters
201
+ const char xsd2[] =
202
+ "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
203
+ "<xs:simpleType name=\"T\">"
204
+ "<xs:restriction base=\"xs:string\">"
205
+ "<xs:length value=\"4\"/></xs:restriction>"
206
+ "</xs:simpleType></xs:schema>";
207
+ LeptrisXsdSchema s2 = leptris_xsd_compile(xsd2, strlen(xsd2), &st);
208
+ ASSERT_EQ(st, LEPTRIS_OK);
209
+ EXPECT_EQ(leptris_xsd_simple_valid(s2, "T", "abcd"), 1);
210
+ EXPECT_EQ(leptris_xsd_simple_valid(s2, "T", "abcde"), 0);
211
+ leptris_xsd_free(s);
212
+ leptris_xsd_free(s2);
213
+ }
214
+
215
+ // leptris-ruby#434: XSD pattern property classes for the Latin-1
216
+ // byte world and character-class SUBTRACTION — the OPC
217
+ // ST_ContentType shape. A pattern that fails to parse rejects
218
+ // everything, so media types failed wholesale.
219
+ TEST(XsdDatatypes, PatternPropertyClassesAndSubtraction) {
220
+ // The OPC ST_ContentType shape, minus the quoted-string member
221
+ // (same property-class + subtraction machinery): type/subtype
222
+ // segments of IsBasicLatin minus Cc controls, split on '/'.
223
+ const char xsd[] =
224
+ "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
225
+ "<xs:simpleType name=\"ST_ContentType\">"
226
+ "<xs:restriction base=\"xs:string\">"
227
+ "<xs:pattern value="
228
+ "\"[\\p{IsBasicLatin}-[\\p{Cc}\\s()<>@,;:]]+/"
229
+ "[\\p{IsBasicLatin}-[\\p{Cc}\\s()<>@,;:]]+\"/>"
230
+ "</xs:restriction></xs:simpleType></xs:schema>";
231
+ LeptrisStatus st = LEPTRIS_OK;
232
+ LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
233
+ ASSERT_EQ(st, LEPTRIS_OK);
234
+ ASSERT_NE(s, (LeptrisXsdSchema)0);
235
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "application/xml"), 1);
236
+ EXPECT_EQ(leptris_xsd_simple_valid(
237
+ s, "ST_ContentType",
238
+ "application/vnd.openxmlformats-officedocument"
239
+ ".wordprocessingml.document+xml"), 1);
240
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "text/plain"), 1);
241
+ // a control char never matches
242
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "app\x01xml"), 0);
243
+ // the slash split is required by the pattern's /+ shape
244
+ EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "application"), 0);
245
+ leptris_xsd_free(s);
246
+ }
247
+
170
248
  // ---- slice 2: lexical validation ----------------------------------
171
249
  namespace {
172
250
 
@@ -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.341",
4
+ "version": "1.9.342",
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.341.0
4
+ version: 1.9.343.0
5
5
  platform: ppc64le-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-11 00:00:00.000000000 Z
11
+ date: 2026-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi