leptris 1.9.353.0-aarch64-linux → 1.9.354.0-aarch64-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: 33d7ddd8895950d807574b1cbe29db03c87d56a39c7bf5054b3a4f05c3f81922
4
- data.tar.gz: 81c106aee0a7548c58427c6e9407a2027f14064f45fa99a30193115a1f469d39
3
+ metadata.gz: 2ad9b75fb3bed39f4a209d4bcfb106e6df5f17f844f0ab6cc80f444d68b96826
4
+ data.tar.gz: 467bd88a6d55ee1d27a713027cfba6d6e986cf34c1bde86740635216b55f712a
5
5
  SHA512:
6
- metadata.gz: 9d87d0cce2b0ee9c0a77a1873096741c9bb00f6cb54f9cb573484999e9a00212f117faa0e736cab90f45481dd9f5d17747ee27ece4e09437d75d94b2cddb9662
7
- data.tar.gz: db35548342690d4cbfcf08b90039857f6d6c8afcbe3c54e65c0731ddc84ea287ea279dc59dd762e66bb56b2dd4a5f26034c505253a27179d895433f13dda7700
6
+ metadata.gz: b6eec93e645291f9f2e5de4d83438bb9a6e84426eab7728fdbc1734d71798ad6df7cb64217f7e6d612c27fac53207f9f213cae6426f25d0583308e5b036ba9f7
7
+ data.tar.gz: db0005386c2b3e2b971f675b7d64a0118d1e03bf297a7a0be2f75484949612bd11c4931fc57c43a9fe32b3a1beac6f48f76bbda62f312c4de11de631f853d67e
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.353"
11
+ LIBLEPTRIS_VERSION = "1.9.354"
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.353.0"
4
+ VERSION = "1.9.354.0"
5
5
  end
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.353
4
+ - libleptris v1.9.354
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,31 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.354] - 2026-10-14
4
+
5
+ ### Fixed
6
+
7
+ - **wasm32/ILP32 portability: 64-bit hash accumulators + enum
8
+ discipline (PR #1697).** The emscripten build (wasm32: size_t and
9
+ uintptr_t are 32-bit) exposed a class the LP64 host lanes never
10
+ see — 17 warnings, all real. The 64-bit FNV-1a basis/prime
11
+ constants sat in size_t, so on 32-bit targets the hash silently
12
+ stopped being FNV-1a (string_view, element_index, xslt_parse);
13
+ accumulators are now uint64_t with one fold at the return.
14
+ acc_ptr_hash shifted a uintptr_t by 33 — UB on 32-bit pointers;
15
+ promoted to 64-bit with the full avalanche. The leptris_set_error
16
+ call sites passed LeptrisStatus constants into the internal
17
+ error-code channel (TODO 98's boundary) — the implicit enum
18
+ casts are explicit at the five sites. LeptrisNodeKind vs
19
+ LeptrisNodeType compares (and the result-type compare) cast
20
+ through int where the same-valued members meet. rng diag calls
21
+ passed arguments the format string never used. emcc: 17 warnings
22
+ -> 0; wasm test gate 5/5; host suite green.
23
+
24
+ ### Changed
25
+
26
+ - (describe changes here)
27
+
28
+
3
29
  ## [1.9.353] - 2026-10-14
4
30
 
5
31
  ### Added
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.353
6
+ VERSION 1.9.354
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -1,5 +1,6 @@
1
1
  #include "../memory/pool.h"
2
2
  #include "string_view.h"
3
+ #include <stdint.h>
3
4
  #include <string.h>
4
5
  #include <stdlib.h>
5
6
  #include <stdio.h>
@@ -133,15 +134,17 @@ int leptris_sv_equals_cstr(const LeptrisStringView* sv, const char* str) {
133
134
  size_t leptris_sv_hash(const LeptrisStringView* sv) {
134
135
  if (!sv || !sv->data) return 0;
135
136
 
136
- const size_t FNV_offset_basis = 14695981039346656037ULL;
137
- const size_t FNV_prime = 1099511628211ULL;
138
-
139
- size_t hash = FNV_offset_basis;
137
+ /* FNV-1a 64: the accumulator stays uint64_t — size_t is
138
+ * 32-bit on wasm32/ILP32, and truncating the basis/prime
139
+ * silently changes the algorithm. Fold once at the return. */
140
+ uint64_t hash = 14695981039346656037ULL;
141
+ const uint64_t FNV_prime = 1099511628211ULL;
140
142
  for (size_t i = 0; i < sv->length; i++) {
141
143
  hash ^= (unsigned char)sv->data[i];
142
144
  hash *= FNV_prime;
143
145
  }
144
- return hash;
146
+ hash ^= hash >> 32;
147
+ return (size_t)hash;
145
148
  }
146
149
 
147
150
  /* Convert to NULL-terminated C string (allocates!) */
@@ -43,11 +43,15 @@ typedef struct {
43
43
 
44
44
  static size_t index_key_hash(const char* s1, size_t l1,
45
45
  const char* s2, size_t l2) {
46
- size_t h = 1469598103934665603ull;
46
+ /* uint64 accumulator: size_t is 32-bit on wasm32/ILP32 and the
47
+ * 64-bit constants would truncate (the multiply lane collapses).
48
+ * Fold once at the return. */
49
+ uint64_t h = 1469598103934665603ull;
47
50
  for (size_t i = 0; i < l1; i++) { h ^= (unsigned char)s1[i]; h *= 1099511628211ull; }
48
51
  for (size_t i = 0; i < l2; i++) { h ^= (unsigned char)s2[i]; h *= 1099511628211ull; }
49
52
  h ^= l1; h *= 1099511628211ull;
50
- return h;
53
+ h ^= h >> 32;
54
+ return (size_t)h;
51
55
  }
52
56
 
53
57
  static void index_key_table_free(IndexKeyTable* t) {
@@ -275,7 +275,7 @@ LEPTRIS_API LeptrisStatus leptris_document_set_root_ex(
275
275
  LeptrisElement* out_installed) {
276
276
  if (out_installed) *out_installed = NULL;
277
277
  if (!doc || !root) {
278
- leptris_set_error(LEPTRIS_ERROR_NULL_ARG,
278
+ leptris_set_error((leptris_error_code)LEPTRIS_ERROR_NULL_ARG,
279
279
  "set_root: NULL document or element");
280
280
  return LEPTRIS_ERROR_NULL_ARG;
281
281
  }
@@ -283,7 +283,7 @@ LEPTRIS_API LeptrisStatus leptris_document_set_root_ex(
283
283
  /* Already attached under a parent? (parent_off == 0 encodes NULL;
284
284
  * leptris_elem_parent is the static inline accessor from dom/element.h) */
285
285
  if (leptris_elem_parent(root)) {
286
- leptris_set_error(LEPTRIS_ERROR_INVALID_ARG,
286
+ leptris_set_error((leptris_error_code)LEPTRIS_ERROR_INVALID_ARG,
287
287
  "set_root: element is attached to a parent");
288
288
  return LEPTRIS_ERROR_INVALID_ARG;
289
289
  }
@@ -301,7 +301,7 @@ LEPTRIS_API LeptrisStatus leptris_document_set_root_ex(
301
301
  if (leptris_element_get_document(root) != doc) {
302
302
  LeptrisElement copy = leptris_element_copy(root, doc);
303
303
  if (!copy) {
304
- leptris_set_error(LEPTRIS_ERROR_MEMORY,
304
+ leptris_set_error((leptris_error_code)LEPTRIS_ERROR_MEMORY,
305
305
  "set_root: adoption copy failed");
306
306
  return LEPTRIS_ERROR_MEMORY;
307
307
  }
@@ -512,8 +512,8 @@ static size_t match_seq(RngVal* v, RngPattern* p, LeptrisNodeRef* kids,
512
512
  case RNG_REF: {
513
513
  RngDefine* d = find_define(v->g, p->name);
514
514
  if (!d || !d->body) {
515
- diag(v, LEPTRIS_DIAG_INVALID, NULL,
516
- "reference to undefined pattern", p->name, NULL);
515
+ diag(v, LEPTRIS_DIAG_INVALID, NULL,
516
+ "reference to undefined pattern '%s'", p->name);
517
517
  return (size_t)-1;
518
518
  }
519
519
  if (v->depth > 200) {
@@ -1854,9 +1854,9 @@ int rng_validate_document(struct leptris_relaxng* rng, LeptrisDocument doc) {
1854
1854
  RngDefine* d = find_define(v.g, start->name);
1855
1855
  if (!d || !d->body) {
1856
1856
  v.quiet = 0;
1857
- diag(&v, LEPTRIS_DIAG_INVALID, root,
1858
- "reference to undefined pattern",
1859
- start->name, NULL);
1857
+ diag(&v, LEPTRIS_DIAG_INVALID, root,
1858
+ "reference to undefined pattern '%s'",
1859
+ start->name);
1860
1860
  rng->error = leptris_strdup(v.err);
1861
1861
  return 0;
1862
1862
  }
@@ -1129,7 +1129,8 @@ LEPTRIS_API LeptrisSchematron leptris_schematron_parse_phase(
1129
1129
  &err);
1130
1130
  leptris_document_free(doc);
1131
1131
  if (!s) {
1132
- leptris_set_error(LEPTRIS_ERROR_PARSE, err ? err : "bad");
1132
+ leptris_set_error((leptris_error_code)LEPTRIS_ERROR_PARSE,
1133
+ err ? err : "bad");
1133
1134
  free(err);
1134
1135
  if (status) *status = LEPTRIS_ERROR_PARSE;
1135
1136
  return NULL;
@@ -904,8 +904,8 @@ struct leptris_xpath_result* evaluate_step(XPathContext* ctx,
904
904
  DEBUG_LOG(" Axis '%s' cannot operate on attribute nodes, skipping", axis_name);
905
905
  continue; /* Skip non-element nodes for other axes */
906
906
  }
907
- } else if (node_ptr && ((LeptrisNode*)node_ptr)->type ==
908
- LEPTRIS_NODE_NAMESPACE) {
907
+ } else if (node_ptr && (int)((LeptrisNode*)node_ptr)->type ==
908
+ (int)LEPTRIS_NODE_NAMESPACE) {
909
909
  /* Synthetic namespace nodes: parent/ancestor axes
910
910
  * resolve through the OWNER element (bug-63); self
911
911
  * is the ns node itself. */
@@ -769,7 +769,7 @@ struct leptris_xpath_result* vm_apply_axis_parent(XPathContext* ctx, XPathVM* vm
769
769
  for (size_t i = 0; i < input->count; i++) {
770
770
  LeptrisNode* in = input->nodes[i];
771
771
  LeptrisElement parent;
772
- if (in && in->type == LEPTRIS_NODE_NAMESPACE) {
772
+ if (in && (int)in->type == (int)LEPTRIS_NODE_NAMESPACE) {
773
773
  /* Namespace nodes' parent is the OWNER element (63). */
774
774
  parent = ((LeptrisNamespaceNode*)in)->owner;
775
775
  } else if (node_is_element(in)) {
@@ -89,7 +89,7 @@ LEPTRIS_API LeptrisXPathResult leptris_xpath_eval_versioned(
89
89
  if (version == LEPTRIS_XPATH_10 &&
90
90
  x10_has_3x_syntax(expression)) {
91
91
  leptris_set_error(
92
- LEPTRIS_ERROR_INVALID_ARG,
92
+ (leptris_error_code)LEPTRIS_ERROR_INVALID_ARG,
93
93
  "XPath 3.x syntax rejected in LEPTRIS_XPATH_10 mode");
94
94
  if (status) *status = LEPTRIS_ERROR_INVALID_ARG;
95
95
  return NULL;
@@ -1133,7 +1133,8 @@ LEPTRIS_API LeptrisXPathResult leptris_xpath_compiled_eval_nodeset(
1133
1133
  struct leptris_xpath_result* r =
1134
1134
  leptris_xpath_compiled_eval(compiled, doc, contexts[i]);
1135
1135
  if (!r) continue;
1136
- if (r->type == LEPTRIS_XPATH_NODESET && r->value.nodeset_value) {
1136
+ if ((int)r->type == (int)LEPTRIS_XPATH_NODESET &&
1137
+ r->value.nodeset_value) {
1137
1138
  XPathNodeSet* ns = r->value.nodeset_value;
1138
1139
  for (size_t j = 0; j < ns->count; j++)
1139
1140
  xpath_nodeset_add(merged, ns->nodes[j]);
@@ -2582,7 +2582,8 @@ static int op_copy(XsltExec* ex, const XsltInstr* in, LeptrisElement node) {
2582
2582
  /* §7.5: copying an ATTRIBUTE (re)binds it on the pending
2583
2583
  * parent — later copies override earlier xsl:attribute values
2584
2584
  * (execution order wins, §7.1.3). */
2585
- if (node && ((LeptrisNode*)node)->type == LEPTRIS_NODE_ATTRIBUTE) {
2585
+ if (node && (int)((LeptrisNode*)node)->type ==
2586
+ (int)LEPTRIS_NODE_ATTRIBUTE) {
2586
2587
  LeptrisAttributeNode* a = (LeptrisAttributeNode*)node;
2587
2588
  if (ex->pending_parent && a->name)
2588
2589
  leptris_element_set_attribute(ex->pending_parent,
@@ -2592,7 +2593,8 @@ static int op_copy(XsltExec* ex, const XsltInstr* in, LeptrisElement node) {
2592
2593
  }
2593
2594
  /* §7.5: copy of a NAMESPACE node declares it on the pending
2594
2595
  * parent (the classic copy-the-namespaces idiom). */
2595
- if (node && ((LeptrisNode*)node)->type == LEPTRIS_NODE_NAMESPACE) {
2596
+ if (node && (int)((LeptrisNode*)node)->type ==
2597
+ (int)LEPTRIS_NODE_NAMESPACE) {
2596
2598
  LeptrisNamespaceNode* ns = (LeptrisNamespaceNode*)node;
2597
2599
  /* The implicit xml prefix is always in scope — copying it
2598
2600
  * would emit a redundant xmlns:xml (libxslt omits it). */
@@ -609,10 +609,13 @@ static struct leptris_xpath_result* acc_result_copy(
609
609
  }
610
610
 
611
611
  static size_t acc_ptr_hash(const void* p) {
612
- uintptr_t h = (uintptr_t)p;
612
+ /* 64-bit promote: uintptr_t is 32-bit on wasm32/ILP32 and the
613
+ * >> 33 shift was UB there (the avalanche assumes 64 bits). */
614
+ uint64_t h = (uint64_t)(uintptr_t)p;
613
615
  h ^= h >> 33;
614
- h *= (uintptr_t)0x9E3779B97F4A7C15ULL;
616
+ h *= 0x9E3779B97F4A7C15ULL;
615
617
  h ^= h >> 29;
618
+ h ^= h >> 32;
616
619
  return (size_t)h;
617
620
  }
618
621
 
@@ -1857,9 +1857,11 @@ static void free_instr_list(XsltInstr* list) {
1857
1857
  * full linear scan produced. Mode buckets: candidate arrays per
1858
1858
  * distinct mode, preserving sheet order. */
1859
1859
  static size_t tpl_name_hash(const char* s) {
1860
- size_t h = 1469598103934665603ull;
1860
+ /* uint64 accumulator: size_t is 32-bit on wasm32/ILP32. */
1861
+ uint64_t h = 1469598103934665603ull;
1861
1862
  while (*s) { h ^= (unsigned char)*s++; h *= 1099511628211ull; }
1862
- return h;
1863
+ h ^= h >> 32;
1864
+ return (size_t)h;
1863
1865
  }
1864
1866
 
1865
1867
  void xslt_sheet_build_dispatch(XsltStylesheet* sheet) {
@@ -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.353",
4
+ "version": "1.9.354",
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.353.0
4
+ version: 1.9.354.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.