leptris 1.9.41 → 1.9.43

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: a670640aa8b76b1d6f14f1e50b54ac329a477a6f293dc17e710524822690b0d8
4
- data.tar.gz: cfc26d52da5bba121bfbd2d3424b4aa64acd6feb1c2a9be143f99002d16aa1fc
3
+ metadata.gz: a87e2a5aa4eddbbaf1140aa87d33fcd3e0dccfb7ea505cbcaf917dbd3bf715fd
4
+ data.tar.gz: '09b6e2b0d46ed3235945f3ad3355fbf46d515ddfc0b3bce2ac75468a80d0af5d'
5
5
  SHA512:
6
- metadata.gz: c2707588ab5775016e0bafd1554f05e872ae98f35cd9bf347471172f1f290f0daa2badda34c0dbdefdcd4c959e5ff3b5855ff1c20c034e91cbf3d508559fda74
7
- data.tar.gz: 5ecbe0965f5e489a9e9eae2fab172a6826a0680ca64856d1a025d822b62c1e88c2badcacd5d6540b5e59144ae6ce5c0311d3e67d012afda5cc9ec0f7804fe566
6
+ metadata.gz: 267bbe8cac5597fa0e40736f087fffc739c9f3c1fb3063fbe652b25bb9e0a958424b283a5933a963c919d20db6128f35dcd2c98b94439613eeed3edcd17877f0
7
+ data.tar.gz: 93075be6a11e7fe9cdebfd812c617fe274ef9f93d67cce33d0c83b6e173b9f1fe6515aaff73907155fd09bae9d4867b8e6e35710551764b5554ea8c1214eefe7
data/CHANGELOG.md CHANGED
@@ -5,6 +5,49 @@ All notable changes to Leptris will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.43] - 2026-08-31
9
+
10
+ ### Fixed
11
+
12
+ - **Pull prefix events surface (leptris-ruby#648's residual)**: the
13
+ engine's pull stream has always carried start/end prefix events
14
+ (codes 8/9; the default namespace's prefix is legitimately `""`)
15
+ — the binding's type map lacked the kinds, silently delivering
16
+ nil-typed Events that the 1.9.42 staging guard then misread as
17
+ corruption on healthy engines. `:start_prefix`/`:end_prefix` now
18
+ map correctly on both cursor and batch paths, and the guard's
19
+ name check only invalidates kinds that must carry names
20
+ (start/end element, PI target). Engine 1.9.21's staging fix
21
+ (upstream #648) verified clean through the batch path once the
22
+ kinds were mapped.
23
+
24
+ ### Meta
25
+
26
+ - The 1.9.19–1.9.21 lockstep is HELD: engine 1.9.19+ carries a DOM
27
+ parse regression — a self-closing element followed by text inside
28
+ a depth-2 parent fails to parse (`<div><p><br/>hello</p></div>`)
29
+ — filed as leptris/leptris#653. `Node#visit` (the #645a
30
+ wrap-free walk), the sized ext-serialize entry (PR #107's
31
+ substance), and this pull fix's engine-1.9.21 verification are
32
+ parked on a branch awaiting the fix.
33
+
34
+ ## [1.9.42] - 2026-08-30
35
+
36
+ ### Fixed
37
+
38
+ - **Pull batch staging corruption: fail loudly, never deliver
39
+ garbage (leptris/leptris#646)**: `leptris_pull_next_batch`'s
40
+ staging arena misplaces record strings once staged content
41
+ crosses its block boundary (~185 bytes of attribute value under
42
+ nested attr-carrying ancestors — the #625 fix family did not
43
+ reach the batch staging). `Parser#each_batch` now validates each
44
+ staged record — unknown type codes, empty/control-byte/invalid-
45
+ encoding names cannot be legal XML events — and raises a
46
+ descriptive error pointing at `#each` (the cursor path reads the
47
+ same documents correctly; SAX default, recorder drain, and DOM
48
+ are unaffected). Bisection attached upstream: ok at 180 staged
49
+ bytes, corrupt at 190, in the minimized shape.
50
+
8
51
  ## [1.9.41] - 2026-08-30
9
52
 
10
53
  ### Changed
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.41"
4
+ VERSION = "1.9.43"
5
5
  end
@@ -766,6 +766,10 @@ module Leptris
766
766
  PULL_PI = 5
767
767
  PULL_END_DOCUMENT = 6
768
768
  PULL_ERROR = 7
769
+ # Prefix events (types.h LeptrisPullEventType 8/9): the
770
+ # default namespace's prefix is legitimately "".
771
+ PULL_START_PREFIX = 8
772
+ PULL_END_PREFIX = 9
769
773
 
770
774
  LEPTRIS_PARSE_DEFAULT = 0
771
775
  LEPTRIS_PARSE_DROP_WS_TEXT = 1
@@ -28,6 +28,13 @@ module Leptris::XML::Pull
28
28
  Leptris::XML::FFI::PULL_PI => :pi,
29
29
  Leptris::XML::FFI::PULL_END_DOCUMENT => :end_document,
30
30
  Leptris::XML::FFI::PULL_ERROR => :error,
31
+ # Prefix events ride the stream ("" prefix = the default
32
+ # namespace): the engine has always delivered them; the map
33
+ # lacked the kinds, silently yielding nil-typed Events — which
34
+ # the staging guard then misread as corruption after the real
35
+ # engine fix landed (leptris/leptris#648's residual).
36
+ Leptris::XML::FFI::PULL_START_PREFIX => :start_prefix,
37
+ Leptris::XML::FFI::PULL_END_PREFIX => :end_prefix,
31
38
  }.freeze
32
39
 
33
40
  class Parser
@@ -85,14 +92,30 @@ module Leptris::XML::Pull
85
92
  name_ptr = buffer.get_pointer(base + name_off)
86
93
  text_ptr = buffer.get_pointer(base + text_off)
87
94
  type = TYPES[buffer.get_int(base + type_off)]
95
+ name = name_ptr.null? ? nil :
96
+ name_ptr.read_string.force_encoding(Encoding::UTF_8)
97
+ # Staging-corruption guard (leptris/leptris#648): the C
98
+ # batch's staging arena misplaces record strings once the
99
+ # staged content crosses its block boundary (~185 bytes of
100
+ # attribute value under nested attr-carrying ancestors) —
101
+ # names come back empty, control-byte-laced, or
102
+ # invalid-encoding, and unknown type codes surface as nil.
103
+ # Element names can never look like that: fail loudly
104
+ # instead of delivering garbage, and point at the cursor
105
+ # path, which reads the same documents correctly.
106
+ if type.nil? ||
107
+ (name && (!name.valid_encoding? ||
108
+ name.match?(/[\x00-\x08\x0e-\x1f]/))) ||
109
+ (%i[start_element end_element pi].include?(type) &&
110
+ (name.nil? || name.empty?))
111
+ raise Leptris::XML::Error,
112
+ "pull batch staging corruption (leptris/leptris#648) — " \
113
+ "use Parser#each (cursor) for this document"
114
+ end
88
115
  text = text_ptr.null? ? nil :
89
116
  text_ptr.read_string.force_encoding(Encoding::UTF_8)
90
117
  text = Leptris::XML::FFI.read_pi_data(text) if type == :pi
91
- Event.new(type,
92
- name_ptr.null? ? nil :
93
- name_ptr.read_string.force_encoding(Encoding::UTF_8),
94
- text, nil
95
- )
118
+ Event.new(type, name, text, nil)
96
119
  end
97
120
  # The attr mirror holds the batch's most recent start.
98
121
  last_start = nil
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.41
4
+ version: 1.9.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.