ext/oj/object.c in oj-3.3.9 vs ext/oj/object.c in oj-3.3.10
- old
+ new
@@ -339,11 +339,11 @@
if (2 == klen && 'u' == key[1]) {
volatile VALUE sc;
volatile VALUE e1;
int slen;
-
+
if (0 == len) {
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "Invalid struct data");
return 1;
}
e1 = *RARRAY_PTR(value);
@@ -378,18 +378,18 @@
if (len - 1 > slen) {
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "Invalid struct data");
} else {
int i;
- for (i = 0; i < slen; i++) {
+ for (i = 0; i < len - 1; i++) {
rb_struct_aset(parent->val, INT2FIX(i), RARRAY_PTR(value)[i + 1]);
}
}
return 1;
} else if (3 <= klen && '#' == key[1]) {
volatile VALUE *a;
-
+
if (2 != len) {
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "invalid hash pair");
return 1;
}
parent->val = rb_hash_new();
@@ -600,11 +600,11 @@
}
} else {
if (3 <= klen && '^' == *key && '#' == key[1] && T_ARRAY == rb_type(value)) {
long len = RARRAY_LEN(value);
volatile VALUE *a = RARRAY_PTR(value);
-
+
if (2 != len) {
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "invalid hash pair");
return;
}
rb_hash_aset(parent->val, *a, a[1]);
@@ -681,10 +681,10 @@
if (0 < i) {
rb_ary_push(stack_peek(&pi->stack)->val, oj_circ_array_get(pi->circ_array, i));
return;
}
-
+
}
}
rb_ary_push(stack_peek(&pi->stack)->val, str_to_value(pi, str, len, orig));
}