nosj 0.4.0-x86_64-linux → 0.4.1-x86_64-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: effa3ad5689bc6b7db21ff87769eb797fb7a5930ed8859b4ff7537e70a8301f4
4
- data.tar.gz: 3c0d90a1732b7ec4db785a91754cea7bb0eb2cd97802eaeb3b3018ea45c0e884
3
+ metadata.gz: 1b1ee57c8d059a5906baba48a25a9cd0ddb58c259110e62b6ce6fe3ba4377e0f
4
+ data.tar.gz: 312af7ca03bb1ea8bf65d8f55d68d4e5a49f8ebccc512246cd14b6652ddf6f09
5
5
  SHA512:
6
- metadata.gz: d54505db98dde8ba148900bae939ef2db8f1d95ca9e837d7acd2eb8efde5dc51f7b576faa5ee79ddf2b306e79ca5dc5c8330760d9521cb076c3c482a38e93a66
7
- data.tar.gz: cfd0a649d0afd2c6f18d0ba11e1293fd2bf7030d4d103e23ff8c68df9519308d99660edd4c431eb0fbddd35ed9959e8bff969e9918fac2a1293884772d7cf114
6
+ metadata.gz: 7f5cec4abab64a013bddbee26c0813750c3d66942dcb94c50c54f499e0d34e5515b34ffe8f2e4cf1ebc6e4c3647604120e3003194f4f87637d8230314e4eecfc
7
+ data.tar.gz: 7916c28d532c41a458d8b0b6aa7e6d37a411574728a0b44e7d526dd397bdd6ce8627060a3255ce4f7685931ee778f67c11fa206af97df9d432e1929d89c168ba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,47 @@
1
+ ## [0.4.1] - 2026-09-25
2
+
3
+ - Fixed a crash in `NOSJ.generate`: an object whose `to_json` or
4
+ `to_s` shrank the array being generated (for example with
5
+ `Array#clear`) made the generator read freed memory, usually a
6
+ segfault. The array length is now re-read for every element, like
7
+ the json gem, so elements a callback appends are emitted too.
8
+ - Fixed memory corruption in `NOSJ.splice`: a replacement value whose
9
+ `to_json` modified the source string, deduplicated a frozen String
10
+ subclass (`-str`), or removed entries from the edits hash could make
11
+ splice read freed memory, copying unrelated heap bytes into the
12
+ result or crashing. All values are now generated before the source
13
+ is read.
14
+ - Fixed `NOSJ.lazy` and `NOSJ.each_line` reading freed memory when the
15
+ source is a frozen String subclass (such as
16
+ `ActiveSupport::SafeBuffer`) or a frozen string carrying instance
17
+ variables, and it is deduplicated with `-str` while the lazy
18
+ document is alive or between lines: Ruby swaps such a string's
19
+ buffer, and the old one kept being read (wrong values, or a crash).
20
+ - Fixed a memory leak in `NOSJ.generate` and `NOSJ.write_file`: an
21
+ exception raised by user code the generator calls bypassed its
22
+ cleanup and leaked its output buffer (megabytes per call after large
23
+ documents). Affected: a raising `respond_to?` or
24
+ `respond_to_missing?`, a raising `to_s` on an encoding-conversion
25
+ error, a raising autoload of `JSON::Fragment` (strict and Rails
26
+ modes), and a raising `Errno` constructor for a failed write. The
27
+ exception still propagates unchanged.
28
+ - Fixed: after a `NoMemoryError` in the middle of a parse (or
29
+ `minify`/`reformat`), the next call on that thread aborted the whole
30
+ process. Per-thread parser state is now recovered instead.
31
+ - `NOSJ::Lazy` nodes now take part in generational GC: holding many
32
+ nodes no longer slows down every minor GC (200,000 live nodes: 2.9 ms
33
+ per minor GC before, 0.1 ms now), and they are freed immediately
34
+ when collected.
35
+ - Fixed: lazy documents opened with `allow_trailing_comma: true` or
36
+ `allow_nan: true` could not be walked. `size`, `keys`, `each`, and
37
+ any lookup that missed or stepped over a trailing comma or a `NaN`
38
+ raised `NOSJ::ParserError`, even though `value` worked.
39
+ - `NOSJ.at_pointer`, `NOSJ.at_pointers`, and `NOSJ.at_pointer_file`
40
+ now honor `allow_nan` and `allow_trailing_comma` while resolving the
41
+ pointer, not only when materializing the matched value.
42
+ - Updated the nosj crate to 0.2.2.
43
+ - Updated dependencies, Magnus bumped to 0.9.0.
44
+
1
45
  ## [0.4.0] - 2026-09-05
2
46
 
3
47
  - Ractors: on Ruby 4.0+, `NOSJ.parse`, `NOSJ.generate`, and every
data/README.md CHANGED
@@ -151,7 +151,8 @@ Example: an early field resolves in ~0.35µs where `JSON.parse(json).dig(...)`
151
151
  costs ~980µs on the same document—three orders of magnitude. A field
152
152
  at the far end of a 570 KB document costs ~71µs, still 13× faster
153
153
  than parse-then-dig. Misses return nil; matched subtrees materialize
154
- with the same options as `parse` (`symbolize_names:`, `freeze:`).
154
+ with the same options as `parse` (`symbolize_names:`, `freeze:`), and
155
+ `allow_nan:`/`allow_trailing_comma:` govern the walk to them too.
155
156
 
156
157
  ### Files API
157
158
 
data/lib/nosj/3.3/nosj.so CHANGED
Binary file
data/lib/nosj/3.4/nosj.so CHANGED
Binary file
data/lib/nosj/4.0/nosj.so CHANGED
Binary file
data/lib/nosj/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module NOSJ
4
4
  # The gem version.
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
data/lib/nosj.rb CHANGED
@@ -205,7 +205,8 @@ module NOSJ
205
205
 
206
206
  # Partial parsing by JSON Pointer (with the standard +~0+/+~1+
207
207
  # escapes). The matched subtree materializes under the same options
208
- # as {.parse}.
208
+ # as {.parse}; +allow_nan+ and +allow_trailing_comma+ also govern the
209
+ # walk to it.
209
210
  #
210
211
  # @example
211
212
  # NOSJ.at_pointer(json, "/users/3/name") #=> "grace" or nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nosj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Yaroslav Markin
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: 3.3.11
68
68
  requirements: []
69
- rubygems_version: 4.0.16
69
+ rubygems_version: 4.0.20
70
70
  specification_version: 4
71
71
  summary: An extremely fast JSON parser and generator for Ruby, written in Rust and
72
72
  SIMD-accelerated on every platform.