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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80fcb3a59fb873da369d49ad3962960b159c0de18580de24da0cbc65935e7275
4
- data.tar.gz: ddcd3f0b95a5a6cd9658c86fff9063bf6bbbc034091a894e8c3c8dcbd4a82e3a
3
+ metadata.gz: 1c6cf97a6abc7ea8698d7a6937bdd9444ed8e2def9447411fc6f2f0aaaaf1c9a
4
+ data.tar.gz: d7c34c8a8de00f25718e2b20a404cc1f929dd091571a49070dee8e7edb18aa6b
5
5
  SHA512:
6
- metadata.gz: a59ab0a3872261dde24fb06612cbc90fbe6d8b06800d5304ba82ce789c0cdcff88c22477b268a8e1161595f97d8b09c0dcbc6b7b25ea7a9373590734618952c0
7
- data.tar.gz: 7a547ff4e19e3ca256762fa5c75598e1aa5cb5bd1a15986a5258b9bdea24be6d4f77d34bfc0d142a061960d30d4b69238bb38b21ebd50095086a99e378eb37e5
6
+ metadata.gz: a89b9497d951820e4d0c3e8e1bc94119acd85efec15a152513e29dd7210e1fbb41153a2205638862199b94eb50b05cc67e1b2fa373c4e0cbb834b44f210bc776
7
+ data.tar.gz: d6ff8fddb8a6bc3475eb6555bdd03794d41ae3c9c553d23d1af3622e5b4c9729001429827eef32e80e8a19c3fd95984ae97eeafa0bca3768f6779d3a0987686a
@@ -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);
@@ -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;
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.10.15'
4
+ VERSION = '3.10.16'
5
5
  end
@@ -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.15
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-16 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler