json 2.18.1 → 2.18.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/CHANGES.md +9 -0
- data/ext/json/ext/parser/parser.c +20 -9
- data/lib/json/version.rb +1 -1
- 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: f2f4e92c83082e5be91872a463b47a8520d0f6b7aae8799bab0d012297065685
|
|
4
|
+
data.tar.gz: 3149e9053445d1ae0397b30bdb95c0f26ed5c56e36506c065e843a37809cd5c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b618febef7ab94710d390a2aab3b3af62080feb5f97dbc1217a94dce790cb5b93837bfd7c2f66eecbdb1358844e7c83b404b1124583a87d73e18f5dd28512b72
|
|
7
|
+
data.tar.gz: 56bed6163cbd092c20fbf4e0ddaf3ecdcf69bc3cc3228ad7407215d9b3aacd8c18b4ddfd0536f23a6d2e19d8fc4ed794b022f987abf44da10bbfef6336c60928
|
data/CHANGES.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
### Unreleased
|
|
4
4
|
|
|
5
|
+
### 2026-11-13 (2.18.3)
|
|
6
|
+
|
|
7
|
+
* Backport handling of unescaped control characters preceeded by a backslash from 2.19.2.
|
|
8
|
+
GHSA-cjpr-jw2g-fw99.
|
|
9
|
+
|
|
10
|
+
### 2026-11-02 (2.18.2)
|
|
11
|
+
|
|
12
|
+
* Fix a format string injection vulnerability in `JSON.parse(doc, allow_duplicate_key: false)`.
|
|
13
|
+
|
|
5
14
|
### 2026-02-03 (2.18.1)
|
|
6
15
|
|
|
7
16
|
* Fix a potential crash in very specific circumstance if GC triggers during a call to `to_json`
|
|
@@ -400,14 +400,9 @@ static void emit_parse_warning(const char *message, JSON_ParserState *state)
|
|
|
400
400
|
|
|
401
401
|
#define PARSE_ERROR_FRAGMENT_LEN 32
|
|
402
402
|
|
|
403
|
-
|
|
404
|
-
RBIMPL_ATTR_NORETURN()
|
|
405
|
-
#endif
|
|
406
|
-
static void raise_parse_error(const char *format, JSON_ParserState *state)
|
|
403
|
+
static VALUE build_parse_error_message(const char *format, JSON_ParserState *state, long line, long column)
|
|
407
404
|
{
|
|
408
405
|
unsigned char buffer[PARSE_ERROR_FRAGMENT_LEN + 3];
|
|
409
|
-
long line, column;
|
|
410
|
-
cursor_position(state, &line, &column);
|
|
411
406
|
|
|
412
407
|
const char *ptr = "EOF";
|
|
413
408
|
if (state->cursor && state->cursor < state->end) {
|
|
@@ -442,11 +437,23 @@ static void raise_parse_error(const char *format, JSON_ParserState *state)
|
|
|
442
437
|
VALUE msg = rb_sprintf(format, ptr);
|
|
443
438
|
VALUE message = rb_enc_sprintf(enc_utf8, "%s at line %ld column %ld", RSTRING_PTR(msg), line, column);
|
|
444
439
|
RB_GC_GUARD(msg);
|
|
440
|
+
return message;
|
|
441
|
+
}
|
|
445
442
|
|
|
443
|
+
static VALUE parse_error_new(VALUE message, long line, long column)
|
|
444
|
+
{
|
|
446
445
|
VALUE exc = rb_exc_new_str(rb_path2class("JSON::ParserError"), message);
|
|
447
446
|
rb_ivar_set(exc, rb_intern("@line"), LONG2NUM(line));
|
|
448
447
|
rb_ivar_set(exc, rb_intern("@column"), LONG2NUM(column));
|
|
449
|
-
|
|
448
|
+
return exc;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
NORETURN(static) void raise_parse_error(const char *format, JSON_ParserState *state)
|
|
452
|
+
{
|
|
453
|
+
long line, column;
|
|
454
|
+
cursor_position(state, &line, &column);
|
|
455
|
+
VALUE message = build_parse_error_message(format, state, line, column);
|
|
456
|
+
rb_exc_raise(parse_error_new(message, line, column));
|
|
450
457
|
}
|
|
451
458
|
|
|
452
459
|
#ifdef RBIMPL_ATTR_NORETURN
|
|
@@ -752,9 +759,8 @@ NOINLINE(static) VALUE json_string_unescape(JSON_ParserState *state, JSON_Parser
|
|
|
752
759
|
}
|
|
753
760
|
raise_parse_error_at("invalid ASCII control character in string: %s", state, pe - 1);
|
|
754
761
|
}
|
|
755
|
-
} else {
|
|
756
|
-
raise_parse_error_at("invalid escape character in string: %s", state, pe - 1);
|
|
757
762
|
}
|
|
763
|
+
raise_parse_error_at("invalid escape character in string: %s", state, pe - 1);
|
|
758
764
|
break;
|
|
759
765
|
}
|
|
760
766
|
}
|
|
@@ -889,6 +895,11 @@ static void raise_duplicate_key_error(JSON_ParserState *state, VALUE duplicate_k
|
|
|
889
895
|
rb_inspect(duplicate_key)
|
|
890
896
|
);
|
|
891
897
|
|
|
898
|
+
long line, column;
|
|
899
|
+
cursor_position(state, &line, &column);
|
|
900
|
+
rb_str_concat(message, build_parse_error_message("", state, line, column)) ;
|
|
901
|
+
rb_exc_raise(parse_error_new(message, line, column));
|
|
902
|
+
|
|
892
903
|
raise_parse_error(RSTRING_PTR(message), state);
|
|
893
904
|
RB_GC_GUARD(message);
|
|
894
905
|
}
|
data/lib/json/version.rb
CHANGED
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.18.
|
|
4
|
+
version: 2.18.3
|
|
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.
|
|
87
|
+
rubygems_version: 4.0.20
|
|
88
88
|
specification_version: 4
|
|
89
89
|
summary: JSON Implementation for Ruby
|
|
90
90
|
test_files: []
|