mini_racer 0.17.0.pre7 → 0.17.0.pre8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/ext/mini_racer_extension/mini_racer_extension.c +25 -6
- data/ext/mini_racer_extension/serde.c +12 -1
- data/lib/mini_racer/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a4649daa0104376800784775a305593ff637dbde023f27ed6d9126b77c54548
|
4
|
+
data.tar.gz: e46ffb00764e6113cef170508d8ed1ac4b68cab29ace1051fc7c5df4c7d97f07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38202ee576c23d016afd7b69ba9bada8ca47a82c3a460c028a42e25c23438f965e4ac2e8d6c4a24bea7211bed6436a9f2cc55bc4c9c0c42fd6b8e5054602c8f5
|
7
|
+
data.tar.gz: e8da8f6787111b63e698db0964a9ad35ffe62c1acca83db7efa08cdb7db94d8d68ed39b989f81fd77b310fff510790d16454761f083bc5bd1154105f93c20f6f
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
- 0.17.0.pre8 - 11-01-2025
|
2
|
+
- Fix handling of UTF 32 LE and Ascii encoding strings - Ben Noordhuis
|
3
|
+
- Handle rare edge case in V8 serialization - Ben Noordhuis
|
4
|
+
|
1
5
|
- 0.17.0.pre7 - 10-01-2025
|
2
6
|
|
3
7
|
- Objects containing non serializable properties will return an Error object vs raising an exception. Ben Noordhuis
|
@@ -422,6 +422,25 @@ static int collect(VALUE k, VALUE v, VALUE a)
|
|
422
422
|
return ST_CONTINUE;
|
423
423
|
}
|
424
424
|
|
425
|
+
static void add_string(Ser *s, VALUE v)
|
426
|
+
{
|
427
|
+
rb_encoding *e;
|
428
|
+
const void *p;
|
429
|
+
size_t n;
|
430
|
+
|
431
|
+
Check_Type(v, T_STRING);
|
432
|
+
e = rb_enc_get(v);
|
433
|
+
p = RSTRING_PTR(v);
|
434
|
+
n = RSTRING_LEN(v);
|
435
|
+
if (e) {
|
436
|
+
if (!strcmp(e->name, "ISO-8859-1"))
|
437
|
+
return ser_string8(s, p, n);
|
438
|
+
if (!strcmp(e->name, "UTF-16LE"))
|
439
|
+
return ser_string16(s, p, n);
|
440
|
+
}
|
441
|
+
return ser_string(s, p, n);
|
442
|
+
}
|
443
|
+
|
425
444
|
static int serialize1(Ser *s, VALUE refs, VALUE v)
|
426
445
|
{
|
427
446
|
unsigned long limbs[64];
|
@@ -525,7 +544,7 @@ static int serialize1(Ser *s, VALUE refs, VALUE v)
|
|
525
544
|
v = rb_sym2str(v);
|
526
545
|
// fallthru
|
527
546
|
case T_STRING:
|
528
|
-
|
547
|
+
add_string(s, v);
|
529
548
|
break;
|
530
549
|
default:
|
531
550
|
snprintf(s->err, sizeof(s->err), "unsupported type %x", TYPE(v));
|
@@ -1062,7 +1081,7 @@ static VALUE context_attach(VALUE self, VALUE name, VALUE proc)
|
|
1062
1081
|
// request is (A)ttach, [name, id] array
|
1063
1082
|
ser_init1(&s, 'A');
|
1064
1083
|
ser_array_begin(&s, 2);
|
1065
|
-
|
1084
|
+
add_string(&s, name);
|
1066
1085
|
ser_int(&s, RARRAY_LENINT(c->procs));
|
1067
1086
|
ser_array_end(&s, 2);
|
1068
1087
|
rb_ary_push(c->procs, proc);
|
@@ -1159,8 +1178,8 @@ static VALUE context_eval(int argc, VALUE *argv, VALUE self)
|
|
1159
1178
|
// request is (E)val, [filename, source] array
|
1160
1179
|
ser_init1(&s, 'E');
|
1161
1180
|
ser_array_begin(&s, 2);
|
1162
|
-
|
1163
|
-
|
1181
|
+
add_string(&s, filename);
|
1182
|
+
add_string(&s, source);
|
1164
1183
|
ser_array_end(&s, 2);
|
1165
1184
|
// response is [result, errname] array
|
1166
1185
|
a = rendezvous(c, &s.b); // takes ownership of |s.b|
|
@@ -1462,7 +1481,7 @@ static VALUE snapshot_initialize(int argc, VALUE *argv, VALUE self)
|
|
1462
1481
|
TypedData_Get_Struct(cv, Context, &context_type, c);
|
1463
1482
|
// request is snapsho(T), "code"
|
1464
1483
|
ser_init1(&s, 'T');
|
1465
|
-
|
1484
|
+
add_string(&s, code);
|
1466
1485
|
// response is [arraybuffer, error]
|
1467
1486
|
a = rendezvous(c, &s.b);
|
1468
1487
|
e = rb_ary_pop(a);
|
@@ -1489,7 +1508,7 @@ static VALUE snapshot_warmup(VALUE self, VALUE arg)
|
|
1489
1508
|
ser_init1(&s, 'W');
|
1490
1509
|
ser_array_begin(&s, 2);
|
1491
1510
|
ser_string8(&s, (const uint8_t *)RSTRING_PTR(ss->blob), RSTRING_LENINT(ss->blob));
|
1492
|
-
|
1511
|
+
add_string(&s, arg);
|
1493
1512
|
ser_array_end(&s, 2);
|
1494
1513
|
// response is [arraybuffer, error]
|
1495
1514
|
a = rendezvous(c, &s.b);
|
@@ -303,6 +303,14 @@ static void ser_string8(Ser *s, const uint8_t *p, size_t n)
|
|
303
303
|
w(s, p, n);
|
304
304
|
}
|
305
305
|
|
306
|
+
// string must be utf16le; |n| is in bytes, not code points
|
307
|
+
static void ser_string16(Ser *s, const void *p, size_t n)
|
308
|
+
{
|
309
|
+
w_byte(s, 'c');
|
310
|
+
w_varint(s, n);
|
311
|
+
w(s, p, n);
|
312
|
+
}
|
313
|
+
|
306
314
|
static void ser_object_begin(Ser *s)
|
307
315
|
{
|
308
316
|
w_byte(s, 'o');
|
@@ -362,6 +370,7 @@ static int des1(char (*err)[64], const uint8_t **p, const uint8_t *pe,
|
|
362
370
|
|
363
371
|
if (depth < 0)
|
364
372
|
return bail(err, "too much recursion");
|
373
|
+
again:
|
365
374
|
if (*p >= pe)
|
366
375
|
goto too_short;
|
367
376
|
switch ((c = *(*p)++)) {
|
@@ -372,7 +381,9 @@ static int des1(char (*err)[64], const uint8_t **p, const uint8_t *pe,
|
|
372
381
|
snprintf(*err, sizeof(*err), "bad tag: %02x", c);
|
373
382
|
}
|
374
383
|
return -1;
|
375
|
-
case '\0': // padding
|
384
|
+
case '\0': // skip alignment padding for two-byte strings
|
385
|
+
if (*p < pe)
|
386
|
+
goto again;
|
376
387
|
break;
|
377
388
|
case '^':
|
378
389
|
if (r_varint(p, pe, &u))
|
data/lib/mini_racer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_racer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.0.
|
4
|
+
version: 0.17.0.pre8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,9 +123,9 @@ licenses:
|
|
123
123
|
- MIT
|
124
124
|
metadata:
|
125
125
|
bug_tracker_uri: https://github.com/discourse/mini_racer/issues
|
126
|
-
changelog_uri: https://github.com/discourse/mini_racer/blob/v0.17.0.
|
127
|
-
documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.17.0.
|
128
|
-
source_code_uri: https://github.com/discourse/mini_racer/tree/v0.17.0.
|
126
|
+
changelog_uri: https://github.com/discourse/mini_racer/blob/v0.17.0.pre8/CHANGELOG
|
127
|
+
documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.17.0.pre8
|
128
|
+
source_code_uri: https://github.com/discourse/mini_racer/tree/v0.17.0.pre8
|
129
129
|
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|