json 2.6.1 → 2.6.3
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 +4 -4
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +2 -2
- data/ext/json/ext/parser/parser.c +16 -7
- data/ext/json/ext/parser/parser.rl +16 -7
- data/lib/json/pure/parser.rb +1 -1
- data/lib/json/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc2f560520b0ab901bb8e064664fc74f0c818947048be8519ec8828c14573009
|
4
|
+
data.tar.gz: 91463f0e0c677b0f431780da2362324a00d3f51baf7ea77485636dee2b400c6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eea451caa191ebe5a93de37238799d2b04ce0657f23a1098243c996a1d5047322c276241c0adb8ffe60cdd8436d46488edcd7aaebb8e2065c7406b387a4b553
|
7
|
+
data.tar.gz: d5cd65f836be70cc02c078589c20c98a85995d75f71a6d02be7bedb5a43d7bc02538859f7fe621eedbe2112a29dc8bc57f995a51c336cc36b85b53a38f82becb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.3
|
@@ -997,10 +997,10 @@ static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_St
|
|
997
997
|
if (!allow_nan) {
|
998
998
|
if (isinf(value)) {
|
999
999
|
fbuffer_free(buffer);
|
1000
|
-
rb_raise(eGeneratorError, "%
|
1000
|
+
rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(tmp));
|
1001
1001
|
} else if (isnan(value)) {
|
1002
1002
|
fbuffer_free(buffer);
|
1003
|
-
rb_raise(eGeneratorError, "%
|
1003
|
+
rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(tmp));
|
1004
1004
|
}
|
1005
1005
|
}
|
1006
1006
|
fbuffer_append_str(buffer, tmp);
|
@@ -948,7 +948,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
948
948
|
|
949
949
|
{p = p - 1; } {p+= 1; cs = 29; goto _out;}
|
950
950
|
} else {
|
951
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
951
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
|
952
952
|
}
|
953
953
|
}
|
954
954
|
np = JSON_parse_float(json, p, pe, result);
|
@@ -990,7 +990,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
990
990
|
if (json->allow_nan) {
|
991
991
|
*result = CInfinity;
|
992
992
|
} else {
|
993
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
993
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 8);
|
994
994
|
}
|
995
995
|
}
|
996
996
|
|
@@ -1002,7 +1002,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
1002
1002
|
if (json->allow_nan) {
|
1003
1003
|
*result = CNaN;
|
1004
1004
|
} else {
|
1005
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
1005
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 2);
|
1006
1006
|
}
|
1007
1007
|
}
|
1008
1008
|
|
@@ -2348,7 +2348,7 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
2348
2348
|
if(cs >= JSON_array_first_final) {
|
2349
2349
|
return p + 1;
|
2350
2350
|
} else {
|
2351
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
2351
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
|
2352
2352
|
return NULL;
|
2353
2353
|
}
|
2354
2354
|
}
|
@@ -2363,9 +2363,17 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|
2363
2363
|
char buf[4];
|
2364
2364
|
|
2365
2365
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
2366
|
+
# ifdef HAVE_RB_ENC_INTERNED_STR
|
2367
|
+
bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1);
|
2368
|
+
# else
|
2366
2369
|
bufferStart = buffer = ALLOC_N(char, bufferSize);
|
2370
|
+
# endif
|
2367
2371
|
} else {
|
2372
|
+
# ifdef HAVE_RB_ENC_INTERNED_STR
|
2373
|
+
bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1);
|
2374
|
+
# else
|
2368
2375
|
bufferStart = buffer = ALLOCA_N(char, bufferSize);
|
2376
|
+
# endif
|
2369
2377
|
}
|
2370
2378
|
|
2371
2379
|
while (pe < stringEnd) {
|
@@ -2405,7 +2413,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|
2405
2413
|
}
|
2406
2414
|
rb_enc_raise(
|
2407
2415
|
EXC_ENCODING eParserError,
|
2408
|
-
"
|
2416
|
+
"incomplete unicode character escape sequence at '%s'", p
|
2409
2417
|
);
|
2410
2418
|
} else {
|
2411
2419
|
UTF32 ch = unescape_unicode((unsigned char *) ++pe);
|
@@ -2418,7 +2426,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|
2418
2426
|
}
|
2419
2427
|
rb_enc_raise(
|
2420
2428
|
EXC_ENCODING eParserError,
|
2421
|
-
"
|
2429
|
+
"incomplete surrogate pair at '%s'", p
|
2422
2430
|
);
|
2423
2431
|
}
|
2424
2432
|
if (pe[0] == '\\' && pe[1] == 'u') {
|
@@ -2950,6 +2958,7 @@ static const char MAYBE_UNUSED(_JSON_nfa_pop_trans)[] = {
|
|
2950
2958
|
*
|
2951
2959
|
* Parses the current JSON text _source_ and returns the complete data
|
2952
2960
|
* structure as a result.
|
2961
|
+
* It raises JSON::ParseError if fail to parse.
|
2953
2962
|
*/
|
2954
2963
|
static VALUE cParser_parse(VALUE self)
|
2955
2964
|
{
|
@@ -3216,7 +3225,7 @@ static VALUE cParser_parse(VALUE self)
|
|
3216
3225
|
if (cs >= JSON_first_final && p == pe) {
|
3217
3226
|
return result;
|
3218
3227
|
} else {
|
3219
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
3228
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
|
3220
3229
|
return Qnil;
|
3221
3230
|
}
|
3222
3231
|
}
|
@@ -222,14 +222,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
222
222
|
if (json->allow_nan) {
|
223
223
|
*result = CNaN;
|
224
224
|
} else {
|
225
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
225
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 2);
|
226
226
|
}
|
227
227
|
}
|
228
228
|
action parse_infinity {
|
229
229
|
if (json->allow_nan) {
|
230
230
|
*result = CInfinity;
|
231
231
|
} else {
|
232
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
232
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 8);
|
233
233
|
}
|
234
234
|
}
|
235
235
|
action parse_string {
|
@@ -245,7 +245,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
245
245
|
fexec p + 10;
|
246
246
|
fhold; fbreak;
|
247
247
|
} else {
|
248
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
248
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
|
249
249
|
}
|
250
250
|
}
|
251
251
|
np = JSON_parse_float(json, fpc, pe, result);
|
@@ -447,7 +447,7 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
447
447
|
if(cs >= JSON_array_first_final) {
|
448
448
|
return p + 1;
|
449
449
|
} else {
|
450
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
450
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
|
451
451
|
return NULL;
|
452
452
|
}
|
453
453
|
}
|
@@ -462,9 +462,17 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|
462
462
|
char buf[4];
|
463
463
|
|
464
464
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
465
|
+
# ifdef HAVE_RB_ENC_INTERNED_STR
|
466
|
+
bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1);
|
467
|
+
# else
|
465
468
|
bufferStart = buffer = ALLOC_N(char, bufferSize);
|
469
|
+
# endif
|
466
470
|
} else {
|
471
|
+
# ifdef HAVE_RB_ENC_INTERNED_STR
|
472
|
+
bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1);
|
473
|
+
# else
|
467
474
|
bufferStart = buffer = ALLOCA_N(char, bufferSize);
|
475
|
+
# endif
|
468
476
|
}
|
469
477
|
|
470
478
|
while (pe < stringEnd) {
|
@@ -504,7 +512,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|
504
512
|
}
|
505
513
|
rb_enc_raise(
|
506
514
|
EXC_ENCODING eParserError,
|
507
|
-
"
|
515
|
+
"incomplete unicode character escape sequence at '%s'", p
|
508
516
|
);
|
509
517
|
} else {
|
510
518
|
UTF32 ch = unescape_unicode((unsigned char *) ++pe);
|
@@ -517,7 +525,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|
517
525
|
}
|
518
526
|
rb_enc_raise(
|
519
527
|
EXC_ENCODING eParserError,
|
520
|
-
"
|
528
|
+
"incomplete surrogate pair at '%s'", p
|
521
529
|
);
|
522
530
|
}
|
523
531
|
if (pe[0] == '\\' && pe[1] == 'u') {
|
@@ -839,6 +847,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
839
847
|
*
|
840
848
|
* Parses the current JSON text _source_ and returns the complete data
|
841
849
|
* structure as a result.
|
850
|
+
* It raises JSON::ParseError if fail to parse.
|
842
851
|
*/
|
843
852
|
static VALUE cParser_parse(VALUE self)
|
844
853
|
{
|
@@ -855,7 +864,7 @@ static VALUE cParser_parse(VALUE self)
|
|
855
864
|
if (cs >= JSON_first_final && p == pe) {
|
856
865
|
return result;
|
857
866
|
} else {
|
858
|
-
rb_enc_raise(EXC_ENCODING eParserError, "
|
867
|
+
rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p);
|
859
868
|
return Qnil;
|
860
869
|
}
|
861
870
|
}
|
data/lib/json/pure/parser.rb
CHANGED
@@ -179,7 +179,7 @@ module JSON
|
|
179
179
|
bytes << c[6 * i + 2, 2].to_i(16) << c[6 * i + 4, 2].to_i(16)
|
180
180
|
i += 1
|
181
181
|
end
|
182
|
-
JSON.iconv('utf-8', 'utf-16be', bytes)
|
182
|
+
JSON.iconv('utf-8', 'utf-16be', bytes).force_encoding(::Encoding::ASCII_8BIT)
|
183
183
|
end
|
184
184
|
end
|
185
185
|
if string.respond_to?(:force_encoding)
|
data/lib/json/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a JSON implementation as a Ruby extension in C.
|
14
14
|
email: flori@ping.de
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.4.0.dev
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: JSON Implementation for Ruby
|