diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-03 15:11:36 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-03 15:11:36 +0000 |
commit | e7da0fc34e8ed7fa250fc38f1109e4944cbad808 (patch) | |
tree | 55736b57c21d42c808ca62ed883501877d0816de /ext/json/parser/parser.rl | |
parent | 27f34274e827dcc034b11963b7b96b33c570b58f (diff) | |
download | ruby-e7da0fc34e8ed7fa250fc38f1109e4944cbad808.tar.gz |
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
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r-- | ext/json/parser/parser.rl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl index fba01ac0e5..edab32b78f 100644 --- a/ext/json/parser/parser.rl +++ b/ext/json/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; |