oj 1.2.6 → 1.2.7

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.

Files changed (4) hide show
  1. data/README.md +3 -1
  2. data/ext/oj/load.c +24 -16
  3. data/lib/oj/version.rb +1 -1
  4. metadata +1 -1
data/README.md CHANGED
@@ -24,7 +24,9 @@ A fast JSON parser and Object marshaller as a Ruby gem.
24
24
 
25
25
  ## <a name="release">Release Notes</a>
26
26
 
27
- ### Release 1.2.6
27
+ ### Release 1.2.7
28
+
29
+ - Fixed bug where a float with too many characters would generate an error. It is not parsed as accuractly as Ruby will support.
28
30
 
29
31
  - Cleaned up documentation errors.
30
32
 
@@ -672,21 +672,15 @@ read_num(ParseInfo pi) {
672
672
  }
673
673
  }
674
674
  for (; '0' <= *pi->s && *pi->s <= '9'; pi->s++) {
675
- n = n * 10 + (*pi->s - '0');
676
- if (NUM_MAX <= n) {
677
- big = 1;
675
+ if (big) {
676
+ big++;
677
+ } else {
678
+ n = n * 10 + (*pi->s - '0');
679
+ if (NUM_MAX <= n) {
680
+ big = 1;
681
+ }
678
682
  }
679
683
  }
680
- if (big) {
681
- char c = *pi->s;
682
- VALUE num;
683
-
684
- *pi->s = '\0';
685
- num = rb_cstr_to_inum(start, 10, 0);
686
- *pi->s = c;
687
-
688
- return num;
689
- }
690
684
  if ('.' == *pi->s) {
691
685
  pi->s++;
692
686
  for (; '0' <= *pi->s && *pi->s <= '9'; pi->s++) {
@@ -707,16 +701,30 @@ read_num(ParseInfo pi) {
707
701
  }
708
702
  }
709
703
  if (0 == e && 0 == a && 1 == div) {
710
- if (neg) {
711
- n = -n;
704
+ if (big) {
705
+ char c = *pi->s;
706
+ VALUE num;
707
+
708
+ *pi->s = '\0';
709
+ num = rb_cstr_to_inum(start, 10, 0);
710
+ *pi->s = c;
711
+
712
+ return num;
713
+ } else {
714
+ if (neg) {
715
+ n = -n;
716
+ }
717
+ return LONG2NUM(n);
712
718
  }
713
- return LONG2NUM(n);
714
719
  } else {
715
720
  double d = (double)n + (double)a / (double)div;
716
721
 
717
722
  if (neg) {
718
723
  d = -d;
719
724
  }
725
+ if (1 < big) {
726
+ e += big - 1;
727
+ }
720
728
  if (0 != e) {
721
729
  if (eneg) {
722
730
  e = -e;
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '1.2.6'
4
+ VERSION = '1.2.7'
5
5
  end
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: 1.2.6
4
+ version: 1.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: