summaryrefslogtreecommitdiff
path: root/ext/json/ext/parser/parser.rl
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-03 15:11:36 +0000
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-10-25 16:23:43 +0800
commit033dd10ac202a94a74652ad93e77c68937cc7b8e (patch)
tree589a4972536128eca2ca25bbb338e4ea3d703f09 /ext/json/ext/parser/parser.rl
parent78baad8e646180deb1d85da20da31398aa68cad4 (diff)
downloadjson-pick-ruby-core.tar.gz
ext/json/parser/parser.c: do not call rb_str_resize() on Time objectpick-ruby-core
* See https://github.com/flori/json/issues/342 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/ext/parser/parser.rl')
-rw-r--r--ext/json/ext/parser/parser.rl4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl
index fba01ac..edab32b 100644
--- a/ext/json/ext/parser/parser.rl
+++ b/ext/json/ext/parser/parser.rl
@@ -554,7 +554,9 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
if (json->symbolize_names && json->parsing_name) {
*result = rb_str_intern(*result);
} else {
- rb_str_resize(*result, RSTRING_LEN(*result));
+ if (RB_TYPE_P(*result, T_STRING)) {
+ rb_str_resize(*result, RSTRING_LEN(*result));
+ }
}
if (cs >= JSON_string_first_final) {
return p + 1;