oj 3.10.15 → 3.10.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/parse.c +6 -12
- data/ext/oj/sparse.c +6 -11
- data/lib/oj/version.rb +1 -1
- data/test/test_compat.rb +6 -0
- 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: 1c6cf97a6abc7ea8698d7a6937bdd9444ed8e2def9447411fc6f2f0aaaaf1c9a
|
4
|
+
data.tar.gz: d7c34c8a8de00f25718e2b20a404cc1f929dd091571a49070dee8e7edb18aa6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a89b9497d951820e4d0c3e8e1bc94119acd85efec15a152513e29dd7210e1fbb41153a2205638862199b94eb50b05cc67e1b2fa373c4e0cbb834b44f210bc776
|
7
|
+
data.tar.gz: d6ff8fddb8a6bc3475eb6555bdd03794d41ae3c9c553d23d1af3622e5b4c9729001429827eef32e80e8a19c3fd95984ae97eeafa0bca3768f6779d3a0987686a
|
data/ext/oj/parse.c
CHANGED
@@ -212,18 +212,6 @@ read_escaped_str(ParseInfo pi, const char *start) {
|
|
212
212
|
case '"': buf_append(&buf, '"'); break;
|
213
213
|
case '/': buf_append(&buf, '/'); break;
|
214
214
|
case '\\': buf_append(&buf, '\\'); break;
|
215
|
-
case '\'':
|
216
|
-
// The json gem claims this is not an error despite the
|
217
|
-
// ECMA-404 indicating it is not valid.
|
218
|
-
if (CompatMode == pi->options.mode) {
|
219
|
-
buf_append(&buf, '\'');
|
220
|
-
} else {
|
221
|
-
pi->cur = s;
|
222
|
-
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "invalid escaped character");
|
223
|
-
buf_cleanup(&buf);
|
224
|
-
return;
|
225
|
-
}
|
226
|
-
break;
|
227
215
|
case 'u':
|
228
216
|
s++;
|
229
217
|
if (0 == (code = read_hex(pi, s)) && err_has(&pi->err)) {
|
@@ -263,6 +251,12 @@ read_escaped_str(ParseInfo pi, const char *start) {
|
|
263
251
|
}
|
264
252
|
break;
|
265
253
|
default:
|
254
|
+
// The json gem claims this is not an error despite the
|
255
|
+
// ECMA-404 indicating it is not valid.
|
256
|
+
if (CompatMode == pi->options.mode) {
|
257
|
+
buf_append(&buf, *s);
|
258
|
+
break;
|
259
|
+
}
|
266
260
|
pi->cur = s;
|
267
261
|
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "invalid escaped character");
|
268
262
|
buf_cleanup(&buf);
|
data/ext/oj/sparse.c
CHANGED
@@ -225,17 +225,6 @@ read_escaped_str(ParseInfo pi) {
|
|
225
225
|
case '"': buf_append(&buf, '"'); break;
|
226
226
|
case '/': buf_append(&buf, '/'); break;
|
227
227
|
case '\\': buf_append(&buf, '\\'); break;
|
228
|
-
case '\'':
|
229
|
-
// The json gem claims this is not an error despite the
|
230
|
-
// ECMA-404 indicating it is not valid.
|
231
|
-
if (CompatMode == pi->options.mode) {
|
232
|
-
buf_append(&buf, '\'');
|
233
|
-
} else {
|
234
|
-
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "invalid escaped character");
|
235
|
-
buf_cleanup(&buf);
|
236
|
-
return;
|
237
|
-
}
|
238
|
-
break;
|
239
228
|
case 'u':
|
240
229
|
if (0 == (code = read_hex(pi)) && err_has(&pi->err)) {
|
241
230
|
buf_cleanup(&buf);
|
@@ -273,6 +262,12 @@ read_escaped_str(ParseInfo pi) {
|
|
273
262
|
}
|
274
263
|
break;
|
275
264
|
default:
|
265
|
+
// The json gem claims this is not an error despite the
|
266
|
+
// ECMA-404 indicating it is not valid.
|
267
|
+
if (CompatMode == pi->options.mode) {
|
268
|
+
buf_append(&buf, c);
|
269
|
+
break;
|
270
|
+
}
|
276
271
|
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "invalid escaped character");
|
277
272
|
buf_cleanup(&buf);
|
278
273
|
return;
|
data/lib/oj/version.rb
CHANGED
data/test/test_compat.rb
CHANGED
@@ -236,6 +236,12 @@ class CompatJuice < Minitest::Test
|
|
236
236
|
assert_equal({"a\nb" => true, "c\td" => false}, obj)
|
237
237
|
end
|
238
238
|
|
239
|
+
def test_invalid_escapes_handled
|
240
|
+
json = '{"subtext":"\"404er\” \w \k \3 \a"}'
|
241
|
+
obj = Oj.compat_load(json)
|
242
|
+
assert_equal({"subtext" => "\"404er” w k 3 a"}, obj)
|
243
|
+
end
|
244
|
+
|
239
245
|
def test_hash_escaping
|
240
246
|
json = Oj.to_json({'<>' => '<>'}, mode: :compat)
|
241
247
|
assert_equal(json, '{"<>":"<>"}')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.10.
|
4
|
+
version: 3.10.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|