yeptris 0.6.74.0 → 0.6.75.0

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: 3b4762cf8a7b3104728660d5502f06c9063ef49f9b50043f21dd74b616991940
4
- data.tar.gz: c8941a08b18e56217feeebf492571bbbed000748dfc6491295e7b5c7d87b5afb
3
+ metadata.gz: 32d32a550526edc74ca4b515f672bdae1bfa5ff27255ddf8ba32819685c71c91
4
+ data.tar.gz: 0ed1184c11dd7103b575326f06a2af4c083bdfdaf3eefe9920e033a91c599275
5
5
  SHA512:
6
- metadata.gz: bd788242d6d3545b227d5b624dae68f1ec99f76b6ff12e016330ddd529628746b277b711d60d3b541a88560015909b89a4fad36d17ab7b702be01a355bd72ad4
7
- data.tar.gz: 13ce7696eb843df14a5025604389efb9c0f2fc6c2bb6bc19e425aed53cf4d24d0a9cee349b809f920d8c96790b524b41ab90cdd851bdb8c6fb913a9c3ca6097c
6
+ metadata.gz: 62a9680473b34c106ad53347d851a38cd4ce90296224f2ceb0fa5429290980a6350241c239b52a7836433e4ee1b6032e06410e8adedd9728aff80896000616ee
7
+ data.tar.gz: 68a4c8a8f2be594e70f679c5ae6df738b723ab8740fbae5bdf1316e5238a9497f887e5d710acfaf4026be819b6b9d53408b8cce8ac85d4e4b9aabc82c8c31a95
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.6.74.0".freeze
6
+ VERSION = "0.6.75.0".freeze
7
7
 
8
8
  # Informational notices are OPT-IN (yeptris-ruby#217): consumers
9
9
  # embed yeptris inside CLIs that assert clean stderr, and a
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(yeptris
6
- VERSION 0.6.74
6
+ VERSION 0.6.75
7
7
  DESCRIPTION "Ultra-fast YAML 1.2 parser, emitter and streamer in C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -122,6 +122,23 @@ yep_sview yep_dom_str_put(yep_dom* d, const char* p, uint32_t len) {
122
122
  if (len == 0) {
123
123
  return sv;
124
124
  }
125
+ /* p may point INTO d->str itself (the sinks stage tag/value pieces
126
+ * via yep_dom_str_tail + yep_dom_str_commit, then re-encode the
127
+ * committed view through dom_str_in): snapshot the self-offset
128
+ * BEFORE str_grow — the grow reallocates and frees the old buffer
129
+ * (the #1468 heap-use-after-free). A staged piece is always
130
+ * committed first, so the region read is within str_len. */
131
+ uint32_t self_off = UINT32_MAX;
132
+ if (d->str != NULL && p >= d->str && p <= d->str + d->str_len) {
133
+ uint64_t off = (uint64_t)(p - d->str);
134
+ if (off + len > d->str_len) {
135
+ /* a staged region extending past str_len would be garbage
136
+ * after the grow — treat as OOM rather than corrupt */
137
+ d->oom = 1;
138
+ return sv;
139
+ }
140
+ self_off = (uint32_t)off;
141
+ }
125
142
  if (!str_grow(d, len)) {
126
143
  /* OOM: an empty view here would silently corrupt the document
127
144
  * (the value reads as ""). Record it; dom_place/dom_open_node
@@ -129,7 +146,7 @@ yep_sview yep_dom_str_put(yep_dom* d, const char* p, uint32_t len) {
129
146
  d->oom = 1;
130
147
  return sv;
131
148
  }
132
- memcpy(d->str + d->str_len, p, len);
149
+ memcpy(d->str + d->str_len, self_off == UINT32_MAX ? p : d->str + self_off, len);
133
150
  sv.off = YEP_SV_INPUT | d->str_len;
134
151
  sv.len = len;
135
152
  d->str_len += len;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.74.0
4
+ version: 0.6.75.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.