diff options
author | Florian Frank <flori@ping.de> | 2019-04-29 15:56:14 +0200 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-14 19:54:48 +0900 |
commit | 7376d70cb0817158a9ce0ef433872be5ca7af56b (patch) | |
tree | a1ec236cda4f6ae63185254f4382ff8b308a1f0f /ext/json/parser/parser.rl | |
parent | ede1a3dc110d3cfc094ce4cd5b27f92cab8b7b6c (diff) |
[flori/json] Only attempt to resize strings not other objects
https://github.com/flori/json/commit/167ada8da7
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r-- | ext/json/parser/parser.rl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl index e634f44b80..6b38bb283a 100644 --- a/ext/json/parser/parser.rl +++ b/ext/json/parser/parser.rl @@ -571,10 +571,8 @@ 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 { - if (RB_TYPE_P(*result, T_STRING)) { - rb_str_resize(*result, RSTRING_LEN(*result)); - } + } else if (RB_TYPE_P(*result, T_STRING)) { + rb_str_resize(*result, RSTRING_LEN(*result)); } if (cs >= JSON_string_first_final) { return p + 1; |