From 033dd10ac202a94a74652ad93e77c68937cc7b8e Mon Sep 17 00:00:00 2001 From: eregon Date: Fri, 3 Aug 2018 15:11:36 +0000 Subject: ext/json/parser/parser.c: do not call rb_str_resize() on Time object * 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 --- ext/json/ext/parser/parser.rl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/json/ext/parser/parser.rl') 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; -- cgit v1.2.1