oj 2.0.5 → 2.0.6

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.

data/README.md CHANGED
@@ -32,6 +32,10 @@ A fast JSON parser and Object marshaller as a Ruby gem.
32
32
 
33
33
  ## <a name="release">Release Notes</a>
34
34
 
35
+ ### Release 2.0.6
36
+
37
+ - Worked around an undocumented feature in linux when using make that misreports the stack limits.
38
+
35
39
  ### Release 2.0.5
36
40
 
37
41
  - DateTimes are now output the same in compat mode for both 1.8.7 and 1.9.3 even though they are implemented differently in each Ruby.
@@ -62,7 +62,7 @@ typedef struct _ParseInfo {
62
62
  char *s; /* current position in buffer */
63
63
  CircArray circ_array;
64
64
  Options options;
65
- void *stack_min;
65
+ char *stack_min;
66
66
  } *ParseInfo;
67
67
 
68
68
  static CircArray circ_array_new(void);
@@ -328,7 +328,7 @@ static VALUE
328
328
  read_next(ParseInfo pi, int hint) {
329
329
  VALUE obj;
330
330
 
331
- if ((void*)&obj < pi->stack_min) {
331
+ if ((char*)&obj < pi->stack_min) {
332
332
  rb_raise(rb_eSysStackError, "JSON is too deeply nested");
333
333
  }
334
334
  next_non_white(pi); // skip white space
@@ -1039,12 +1039,14 @@ oj_parse(char *json, Options options) {
1039
1039
  }
1040
1040
  pi.options = options;
1041
1041
  #if IS_WINDOWS
1042
- pi.stack_min = (void*)((char*)&obj - (512 * 1024)); // assume a 1M stack and give half to ruby
1042
+ pi.stack_min = (char*)&obj - (512 * 1024); // assume a 1M stack and give half to ruby
1043
1043
  #else
1044
1044
  {
1045
1045
  struct rlimit lim;
1046
1046
 
1047
- if (0 == getrlimit(RLIMIT_STACK, &lim)) {
1047
+ // When run under make on linux the limit is not reported corrected and is infinity even though
1048
+ // the return code indicates no error. That forces the rlim_cur value as well as the return code.
1049
+ if (0 == getrlimit(RLIMIT_STACK, &lim) && RLIM_INFINITY != lim.rlim_cur) {
1048
1050
  pi.stack_min = (void*)((char*)&obj - (lim.rlim_cur / 4 * 3)); // let 3/4ths of the stack be used only
1049
1051
  } else {
1050
1052
  pi.stack_min = 0; // indicates not to check stack limit
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.0.5'
4
+ VERSION = '2.0.6'
5
5
  end
@@ -1,2 +1,4 @@
1
- Oj.load(%{{"json_class":"#{'x'*1300}"}})
1
+ require 'oj'
2
+ puts Oj.load('{}')
3
+
2
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-16 00:00:00.000000000 Z
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'The fastest JSON parser and object serializer. '
15
15
  email: peter@ohler.com