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 +4 -4
- data/README.md +4 -0
- data/ext/oj/buf.h +4 -4
- data/lib/oj/version.rb +1 -1
- data/test/bug.rb +1 -3
- data/test/test_strict.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 362c05976208620196631aa5d6cd69759c2eec9f
|
4
|
+
data.tar.gz: 95cd1d6833702d958b5b8eecfd5e3480e75e8736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/ext/oj/buf.h
CHANGED
@@ -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++;
|
data/lib/oj/version.rb
CHANGED
data/test/bug.rb
CHANGED
data/test/test_strict.rb
CHANGED
@@ -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.
|
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-
|
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
|