json 2.21.1 → 2.21.2
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/CHANGES.md +4 -0
- data/ext/json/ext/parser/extconf.rb +6 -0
- data/ext/json/ext/parser/parser.c +11 -4
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +13 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea6afdf75f49e474e408c24daae4856891310979fbb10aa34ead66ad2fbf3321
|
|
4
|
+
data.tar.gz: 19eb129df23cde0ac607fa6ddf909d6ea5eaef0035b2180eea4c2c8a7a5c5ff0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2212cdac41569ebd41e83e6d1ea3324e944f6a8db0070a2805f2213da7341a05cc8eab4dc6d77852f30d31a8951f36d435fdb0aff647776eb8f42cee25113ef
|
|
7
|
+
data.tar.gz: b16fdb8a1f5384aa6e9064c7884c0f7ec96632bc2c1c6324cc2e902459e9ac94559ec691cf45dea30fc374fab74ce4e3a82f8bb9d0ec22e0ddd5357764076942
|
data/CHANGES.md
CHANGED
|
@@ -30,6 +30,12 @@ end
|
|
|
30
30
|
|
|
31
31
|
append_cflags("-std=c99")
|
|
32
32
|
|
|
33
|
+
# Disable function outlining on clang to prevent some of the repeated instructions
|
|
34
|
+
# in json_eat_whitespace being outlined into function calls.
|
|
35
|
+
# Note: This verifies '-mno-outline' is accepted as a valid compiler flag
|
|
36
|
+
# and will not pass it if unsupported.
|
|
37
|
+
append_cflags("-mno-outline")
|
|
38
|
+
|
|
33
39
|
if enable_config('parser-use-simd', default=!ENV["JSON_DISABLE_SIMD"])
|
|
34
40
|
load __dir__ + "/../simd/conf.rb"
|
|
35
41
|
end
|
|
@@ -589,6 +589,8 @@ static inline char peek(JSON_ParserState *state)
|
|
|
589
589
|
|
|
590
590
|
static void cursor_position(JSON_ParserState *state, long *line_out, long *column_out)
|
|
591
591
|
{
|
|
592
|
+
JSON_ASSERT(!state->parser);
|
|
593
|
+
JSON_ASSERT(state->cursor);
|
|
592
594
|
JSON_ASSERT(state->cursor <= state->end);
|
|
593
595
|
|
|
594
596
|
// Redundant but helpful for hardening
|
|
@@ -621,10 +623,14 @@ static const unsigned int MAX_DEPRECATIONS = 5;
|
|
|
621
623
|
|
|
622
624
|
static void emit_parse_warning(const char *message, JSON_ParserState *state)
|
|
623
625
|
{
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
626
|
+
VALUE warning;
|
|
627
|
+
if (state->parser) { // line and columns can't be accurate in resumable
|
|
628
|
+
warning = rb_utf8_str_new_cstr(message);
|
|
629
|
+
} else {
|
|
630
|
+
long line, column;
|
|
631
|
+
cursor_position(state, &line, &column);
|
|
632
|
+
warning = rb_sprintf("%s at line %ld column %ld", message, line, column);
|
|
633
|
+
}
|
|
628
634
|
rb_funcall(mJSON, rb_intern("deprecation_warning"), 1, warning);
|
|
629
635
|
}
|
|
630
636
|
|
|
@@ -2566,6 +2572,7 @@ static VALUE cResumableParser_parse(VALUE self)
|
|
|
2566
2572
|
if (eos(&parser->state)) {
|
|
2567
2573
|
json_str_clear(parser->buffer);
|
|
2568
2574
|
parser->buffer = Qfalse;
|
|
2575
|
+
parser->state.start = parser->state.cursor = parser->state.end = 0;
|
|
2569
2576
|
}
|
|
2570
2577
|
parser->in_use = false;
|
|
2571
2578
|
|
data/lib/json/version.rb
CHANGED
data/lib/json.rb
CHANGED
|
@@ -121,9 +121,11 @@ require 'json/common'
|
|
|
121
121
|
# ====== Input Options
|
|
122
122
|
#
|
|
123
123
|
# Option +max_nesting+ (\Integer) specifies the maximum nesting depth allowed;
|
|
124
|
-
# defaults to +100+;
|
|
124
|
+
# defaults to +100+;
|
|
125
|
+
# You can set it to +false+ to disable depth checking entirely, but that is dangerous
|
|
126
|
+
# when parsing untrusted input.
|
|
125
127
|
#
|
|
126
|
-
# With the default, +
|
|
128
|
+
# With the default, +100+:
|
|
127
129
|
# source = '[0, [1, [2, [3]]]]'
|
|
128
130
|
# ruby = JSON.parse(source)
|
|
129
131
|
# ruby # => [0, [1, [2, [3]]]]
|
|
@@ -384,6 +386,15 @@ require 'json/common'
|
|
|
384
386
|
# # Raises JSON::NestingError (nesting of 2 is too deep):
|
|
385
387
|
# JSON.generate(obj, max_nesting: 2)
|
|
386
388
|
#
|
|
389
|
+
# With +false+:
|
|
390
|
+
# obj = []
|
|
391
|
+
# obj[0] = obj
|
|
392
|
+
# # Raises SystemStackError: stack level too deep
|
|
393
|
+
# JSON.generate(obj, max_nesting: false)
|
|
394
|
+
#
|
|
395
|
+
# Setting +max_nesting+ to +false+ can lead to a stackoverflow and may leave the program
|
|
396
|
+
# in an unrecoverable state. It is discouraged.
|
|
397
|
+
#
|
|
387
398
|
# ====== Escaping Options
|
|
388
399
|
#
|
|
389
400
|
# Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.21.
|
|
4
|
+
version: 2.21.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
85
|
version: '0'
|
|
86
86
|
requirements: []
|
|
87
|
-
rubygems_version: 4.0.
|
|
87
|
+
rubygems_version: 4.0.16
|
|
88
88
|
specification_version: 4
|
|
89
89
|
summary: JSON Implementation for Ruby
|
|
90
90
|
test_files: []
|