leptris 1.9.41 → 1.9.42

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: 5de687a1b7597e0bdf6ff80f85566435d9927e136a86ec758a554928d85910d2
4
+ data.tar.gz: 9171a19d4620e4d482c573e1f21e76a8ee253b175a8df34569e9711f1fcc42e4
5
5
  SHA512:
6
- metadata.gz: c2707588ab5775016e0bafd1554f05e872ae98f35cd9bf347471172f1f290f0daa2badda34c0dbdefdcd4c959e5ff3b5855ff1c20c034e91cbf3d508559fda74
7
- data.tar.gz: 5ecbe0965f5e489a9e9eae2fab172a6826a0680ca64856d1a025d822b62c1e88c2badcacd5d6540b5e59144ae6ce5c0311d3e67d012afda5cc9ec0f7804fe566
6
+ metadata.gz: b2dadeb0a139c9a6396dd82defd080dc014e056a8959321a7f7dff13851503d8d53b6a7b1dc4f987a4bb131ce9054e3c0073d7234d6a8ff0e73caae2fc71cf7e
7
+ data.tar.gz: 1648229492701f2805e405475b7abf4f59108844d79da56118f47e15fdb048ebf03f5b7a1d4c3f48c566e2c13b1881b50b7a09df9512fcb2cd928ae045260f3a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ 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.42] - 2026-08-30
9
+
10
+ ### Fixed
11
+
12
+ - **Pull batch staging corruption: fail loudly, never deliver
13
+ garbage (leptris/leptris#646)**: `leptris_pull_next_batch`'s
14
+ staging arena misplaces record strings once staged content
15
+ crosses its block boundary (~185 bytes of attribute value under
16
+ nested attr-carrying ancestors — the #625 fix family did not
17
+ reach the batch staging). `Parser#each_batch` now validates each
18
+ staged record — unknown type codes, empty/control-byte/invalid-
19
+ encoding names cannot be legal XML events — and raises a
20
+ descriptive error pointing at `#each` (the cursor path reads the
21
+ same documents correctly; SAX default, recorder drain, and DOM
22
+ are unaffected). Bisection attached upstream: ok at 180 staged
23
+ bytes, corrupt at 190, in the minimized shape.
24
+
8
25
  ## [1.9.41] - 2026-08-30
9
26
 
10
27
  ### 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.42"
5
5
  end
@@ -85,14 +85,28 @@ module Leptris::XML::Pull
85
85
  name_ptr = buffer.get_pointer(base + name_off)
86
86
  text_ptr = buffer.get_pointer(base + text_off)
87
87
  type = TYPES[buffer.get_int(base + type_off)]
88
+ name = name_ptr.null? ? nil :
89
+ name_ptr.read_string.force_encoding(Encoding::UTF_8)
90
+ # Staging-corruption guard (leptris/leptris#646): the C
91
+ # batch's staging arena misplaces record strings once the
92
+ # staged content crosses its block boundary (~185 bytes of
93
+ # attribute value under nested attr-carrying ancestors) —
94
+ # names come back empty, control-byte-laced, or
95
+ # invalid-encoding, and unknown type codes surface as nil.
96
+ # Element names can never look like that: fail loudly
97
+ # instead of delivering garbage, and point at the cursor
98
+ # path, which reads the same documents correctly.
99
+ if type.nil? ||
100
+ (name && (name.empty? || !name.valid_encoding? ||
101
+ name.match?(/[\x00-\x08\x0e-\x1f]/)))
102
+ raise Leptris::XML::Error,
103
+ "pull batch staging corruption (leptris/leptris#646) — " \
104
+ "use Parser#each (cursor) for this document"
105
+ end
88
106
  text = text_ptr.null? ? nil :
89
107
  text_ptr.read_string.force_encoding(Encoding::UTF_8)
90
108
  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
- )
109
+ Event.new(type, name, text, nil)
96
110
  end
97
111
  # The attr mirror holds the batch's most recent start.
98
112
  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.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.