oj 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oj might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a6eb31374aec1871cad89ee54750d2223cbd817
4
- data.tar.gz: 418dcce615bc52dac68170d152c8934be5d2a68d
3
+ metadata.gz: 362c05976208620196631aa5d6cd69759c2eec9f
4
+ data.tar.gz: 95cd1d6833702d958b5b8eecfd5e3480e75e8736
5
5
  SHA512:
6
- metadata.gz: d566a85337ca2ee4df8500eb75a23c20c93ce26e74f7f57f48215f81faaf4396dce0a58ba0d40391ee32364fab2f1b171ede4c2f879f87c242bad53fd7af8242
7
- data.tar.gz: cea71e839082f2aba82511a2a9886115496b8da839616d2f0020c5bc25eb9603825ed667a4ec6832825539a3482590a827b1a5115e226cc17f5639f8d66cae35
6
+ metadata.gz: 672874c0393c2e718c8cef9ddf2a479f730df35c08a39fa36da00c3a4bc8b7fa3d45ff5db41379525212c04d70ec2e805666ee55c1c6d5a06c81e3fbe682db63
7
+ data.tar.gz: 84c9d719920d5fe073a4980b43861d0315f84d8910d820598a3835e47fa6a1a7fc7074fb3d5049073c32bddefade970167990debdc7fd61f0faed3c97a9dc52f
data/README.md CHANGED
@@ -20,6 +20,10 @@ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announceme
20
20
 
21
21
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
22
22
 
23
+ ### Current Release 2.1.1
24
+
25
+ - Fixed off by 1 error in buffer for escaped strings.
26
+
23
27
  ### Current Release 2.1.0
24
28
 
25
29
  - This version is a major rewrite of the parser. The parser now uses a constant
@@ -34,16 +34,16 @@
34
34
  #include "ruby.h"
35
35
 
36
36
  typedef struct _Buf {
37
- char base[1024];
38
37
  char *head;
39
38
  char *end;
40
39
  char *tail;
40
+ char base[1024];
41
41
  } *Buf;
42
42
 
43
43
  inline static void
44
44
  buf_init(Buf buf) {
45
45
  buf->head = buf->base;
46
- buf->end = buf->base + sizeof(buf->base);
46
+ buf->end = buf->base + sizeof(buf->base) - 1;
47
47
  buf->tail = buf->head;
48
48
  }
49
49
 
@@ -73,7 +73,7 @@ buf_append_string(Buf buf, const char *s, size_t slen) {
73
73
  REALLOC_N(buf->head, char, new_len);
74
74
  }
75
75
  buf->tail = buf->head + toff;
76
- buf->end = buf->head + new_len;
76
+ buf->end = buf->head + new_len - 1;
77
77
  }
78
78
  memcpy(buf->tail, s, slen);
79
79
  buf->tail += slen;
@@ -93,7 +93,7 @@ buf_append(Buf buf, char c) {
93
93
  REALLOC_N(buf->head, char, new_len);
94
94
  }
95
95
  buf->tail = buf->head + toff;
96
- buf->end = buf->head + new_len;
96
+ buf->end = buf->head + new_len - 1;
97
97
  }
98
98
  *buf->tail = c;
99
99
  buf->tail++;
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.1'
5
5
  end
@@ -12,6 +12,4 @@ $: << File.join(File.dirname(__FILE__), "../ext")
12
12
 
13
13
  require 'oj'
14
14
 
15
- n = 17572
16
- Oj.strict_load('[' * n + ']' * n)
17
-
15
+ Oj.load_file('josh2.json', :mode => :strict)
@@ -88,6 +88,14 @@ class StrictJuice < ::Test::Unit::TestCase
88
88
  assert_equal(json, json2)
89
89
  end
90
90
 
91
+ def test_unicode_long
92
+ # tests buffer overflow
93
+ json = %{"\\u019f\\u05e9\\u3074\\ud834\\udd1e #{'x' * 2000}"}
94
+ obj = Oj.load(json)
95
+ json2 = Oj.dump(obj, :ascii_only => true)
96
+ assert_equal(json, json2)
97
+ end
98
+
91
99
  def test_array
92
100
  dump_and_load([], false)
93
101
  dump_and_load([true, false], false)
@@ -239,6 +247,7 @@ class StrictJuice < ::Test::Unit::TestCase
239
247
  assert_equal({ 'x' => true, 'y' => 58, 'z' => [1, 2, 3]}, obj)
240
248
  end
241
249
 
250
+
242
251
  def dump_and_load(obj, trace=false)
243
252
  json = Oj.dump(obj, :indent => 2)
244
253
  puts json if trace
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: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-16 00:00:00.000000000 Z
11
+ date: 2013-06-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'The fastest JSON parser and object serializer. '
14
14
  email: peter@ohler.com