yeptris 0.6.53.0-aarch64-linux → 0.6.54.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: 7da4dd87e39d9fc312c8bd66401a559a02c17ea2607ca0215ef0f916591b5a63
4
- data.tar.gz: e5507aa697d8896f7e676b13c73800d7b4b4cdecc93d200eb97b9d58bad56d4a
3
+ metadata.gz: c6ce5d5e18e39661e1f2dc0dcd4e49955f1970bf02ad2cb9d71971c9b723c0ac
4
+ data.tar.gz: 8badf9b17d292969d94ea245c113f888bbd7c1e5f14336ff7a2555977aa75fc3
5
5
  SHA512:
6
- metadata.gz: 334f53e396208996b0415b3b0fa092647f23cb8f8c8d16c55e6122084a743f67a1c6eb2c379a5537cd5c063030ba7a973ba1d1bd91258c03fd4a4be3e3f27b5f
7
- data.tar.gz: b3da6f8e45c8583ed6069028e3a9b335d150f09f81db2cb24af6c2bad2a18930df259b29e53ed943dc255585db4d0ad09161cdd42363191b361c0b1c30bf9c10
6
+ metadata.gz: 1f2a50a420d2efcac626aff20dd83af6d9f132e4a112d542600354cf5639e798bfc9d0aba1cd1f02e88f76b7499855f0e1556d7cff36d46d9390cd35ce2a6f0b
7
+ data.tar.gz: 5aa4a9bdee9500c933f77a9d81b0f87f53aa2501106e1efb72ed10c1fea07bf5aa7e5ee510086dfb8261267c3346085839f20061a9e5b386eebb50e5ce520c09
@@ -11,8 +11,8 @@
11
11
 
12
12
  #define YEPTRIS_VERSION_MAJOR 0
13
13
  #define YEPTRIS_VERSION_MINOR 6
14
- #define YEPTRIS_VERSION_PATCH 53
15
- #define YEPTRIS_VERSION_STRING "0.6.53"
14
+ #define YEPTRIS_VERSION_PATCH 54
15
+ #define YEPTRIS_VERSION_STRING "0.6.54"
16
16
 
17
17
  #ifdef __cplusplus
18
18
  extern "C" {
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.53.0".freeze
6
+ VERSION = "0.6.54.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
data/libyeptris.so CHANGED
Binary file
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(yeptris
6
- VERSION 0.6.53
6
+ VERSION 0.6.54
7
7
  DESCRIPTION "Ultra-fast YAML 1.2 parser, emitter and streamer in C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -92,7 +92,9 @@ static void yep_avx2_copy_count3(char* dst, const char* src, size_t len, char c0
92
92
  memcpy(dst + i, src + i, len - i);
93
93
  }
94
94
  size_t ta = 0, tb = 0, td = 0;
95
- yep_text_count3_scalar(dst + i, len - i, c0, c1, c2, &ta, &tb, &td);
95
+ if (i < len) { /* NULL dst + 0 offset is still UB to form */
96
+ yep_text_count3_scalar(dst + i, len - i, c0, c1, c2, &ta, &tb, &td);
97
+ }
96
98
  *n0 = a + ta;
97
99
  *n1 = b + tb;
98
100
  *n2 = d + td;
@@ -95,6 +95,15 @@ static int yep_transcode_utf16(const yep_allocator* sys, int big_endian, const u
95
95
  static int yep_transcode_utf32(const yep_allocator* sys, int big_endian, const unsigned char* src,
96
96
  size_t len, unsigned char** out, size_t* out_len, size_t* err_pos) {
97
97
  size_t units = len / 4;
98
+ if (len % 4 != 0) {
99
+ /* a dangling final unit is an error, not a silent truncation
100
+ * (the UTF-16 twin rejects its own; the header contract says
101
+ * truncated units error at the offending byte) */
102
+ if (err_pos != NULL) {
103
+ *err_pos = units * 4;
104
+ }
105
+ return -2;
106
+ }
98
107
  unsigned char* dst = yep_alloc(sys, len ? len : 1);
99
108
  if (dst == NULL) {
100
109
  return -1;
@@ -29,8 +29,14 @@ void yep_rec_free(yep_rec_store* s) {
29
29
  yep_rec_init(s);
30
30
  }
31
31
 
32
- static uint32_t arena_put(yep_rec_store* s, const char* p, uint32_t len) {
32
+ /* Returns 0 ok / -1 OOM. On OOM the record is NOT committed (the
33
+ * caller unwinds before s->n++): the old drop-the-string form left
34
+ * value_len set with offset 0, so materialize read whatever string
35
+ * lived at the arena head - or past a NULL arena on first-alloc
36
+ * failure. */
37
+ static int arena_put(yep_rec_store* s, const char* p, uint32_t len, uint32_t* off) {
33
38
  if (len == 0 || p == NULL) {
39
+ *off = 0;
34
40
  return 0;
35
41
  }
36
42
  if (s->arena_len + len > s->arena_cap) {
@@ -40,15 +46,15 @@ static uint32_t arena_put(yep_rec_store* s, const char* p, uint32_t len) {
40
46
  }
41
47
  char* na = realloc(s->arena, cap);
42
48
  if (na == NULL) {
43
- return 0; /* OOM: the string is dropped, not fatal */
49
+ return -1;
44
50
  }
45
51
  s->arena = na;
46
52
  s->arena_cap = cap;
47
53
  }
48
54
  memcpy(s->arena + s->arena_len, p, len);
49
- uint32_t off = (uint32_t)s->arena_len;
55
+ *off = (uint32_t)s->arena_len;
50
56
  s->arena_len += len;
51
- return off;
57
+ return 0;
52
58
  }
53
59
 
54
60
  int yep_rec_on_event(void* ctx, const yep_event* ev) {
@@ -116,11 +122,17 @@ int yep_rec_on_event(void* ctx, const yep_event* ev) {
116
122
  r->col = ev->col;
117
123
  r->end_line = ev->end_line;
118
124
  r->end_col = ev->end_col;
119
- r->value_off = arena_put(s, (const char*)ev->value.p, (uint32_t)ev->value.len);
125
+ if (arena_put(s, (const char*)ev->value.p, (uint32_t)ev->value.len, &r->value_off) != 0) {
126
+ return -1;
127
+ }
120
128
  r->value_len = (uint32_t)ev->value.len;
121
- r->anchor_off = arena_put(s, (const char*)ev->anchor.p, (uint32_t)ev->anchor.len);
129
+ if (arena_put(s, (const char*)ev->anchor.p, (uint32_t)ev->anchor.len, &r->anchor_off) != 0) {
130
+ return -1;
131
+ }
122
132
  r->anchor_len = (uint32_t)ev->anchor.len;
123
- r->tag_off = arena_put(s, (const char*)ev->tag.p, (uint32_t)ev->tag.len);
133
+ if (arena_put(s, (const char*)ev->tag.p, (uint32_t)ev->tag.len, &r->tag_off) != 0) {
134
+ return -1;
135
+ }
124
136
  r->tag_len = (uint32_t)ev->tag.len;
125
137
  s->n++;
126
138
  return 0;
@@ -161,7 +161,7 @@ YEPTRIS_API const YeptrisEvent* yeptris_iterparse_next(YeptrisIterparse it, size
161
161
  yep_engine_destroy(eng);
162
162
  if (rc == -1) {
163
163
  it->done = 1;
164
- it->status = YEPTRIS_ERROR_PARSE;
164
+ it->status = err != NULL ? YEPTRIS_ERROR_PARSE : YEPTRIS_ERROR_MEMORY;
165
165
  if (it->store.n == 0) {
166
166
  if (!it->emitted_stream_start) {
167
167
  /* the engine emitted +STR before failing: match it */
@@ -74,9 +74,13 @@ YEPTRIS_API YeptrisStatus yeptris_recorder_feed(YeptrisRecorder rec, const char*
74
74
  if (err != NULL) {
75
75
  rec->err_line = err->line;
76
76
  rec->err_col = err->col;
77
+ rec->status = YEPTRIS_ERROR_PARSE;
78
+ } else {
79
+ /* a clean error channel means the SINK failed: the capture
80
+ * ran out of memory, the bytes never were a parse error */
81
+ rec->status = YEPTRIS_ERROR_MEMORY;
77
82
  }
78
- rec->final_fed = 1; /* a parse error kills the stream */
79
- rec->status = YEPTRIS_ERROR_PARSE;
83
+ rec->final_fed = 1; /* a failed feed kills the stream */
80
84
  return rec->status;
81
85
  }
82
86
  rec->status = YEPTRIS_OK;
@@ -85,6 +85,14 @@ void* yep_arena_alloc(yep_arena* arena, size_t size, size_t align) {
85
85
  if (arena == NULL || size == 0 || !yep_align_ok(align)) {
86
86
  return NULL;
87
87
  }
88
+ /* a hostile size near SIZE_MAX must FAIL the fit test, not wrap
89
+ * start+size past the pointer space and pass it (the sizing sums
90
+ * below stay inside the guard's slack) */
91
+ if (size > (SIZE_MAX - align) / 2) {
92
+ /* half the pointer space: both the fit test's start+size and
93
+ * the new-block payload sums stay wrap-free below this */
94
+ return NULL;
95
+ }
88
96
 
89
97
  yep_arena_block* b = arena->head;
90
98
  uintptr_t base = (uintptr_t)b + sizeof(yep_arena_block);
@@ -43,6 +43,13 @@ void* yep_pool_alloc(yep_pool* pool, size_t size, size_t align) {
43
43
  if (pool == NULL || size == 0 || !yep_align_ok(align)) {
44
44
  return NULL;
45
45
  }
46
+ /* mirror of the arena guard: the fit test's start+size and the
47
+ * payload sums must not wrap on a hostile size */
48
+ if (size > (SIZE_MAX - align) / 2) {
49
+ /* half the pointer space: both the fit test's start+size and
50
+ * the new-block payload sums stay wrap-free below this */
51
+ return NULL;
52
+ }
46
53
 
47
54
  yep_block* b = pool->head;
48
55
  if (b == NULL) { /* the lazy first block (#157) */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.53.0
4
+ version: 0.6.54.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-31 00:00:00.000000000 Z
11
+ date: 2026-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi