diff options
author | Florian Frank <flori@ping.de> | 2019-04-29 15:56:14 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2019-04-29 15:56:14 +0200 |
commit | 167ada8da7299fd27314fadad3797b48cee442b1 (patch) | |
tree | aa363d72af41529ef5d9422a5467913d1e6b0614 | |
parent | f9c6de20ba889a32385aaf847d23fb640eca21a6 (diff) | |
download | json-167ada8da7299fd27314fadad3797b48cee442b1.tar.gz |
Only attempt to resize strings not other objects
-rw-r--r-- | ext/json/ext/parser/parser.c | 2 | ||||
-rw-r--r-- | ext/json/ext/parser/parser.rl | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index d2e4eb6..3a9dc93 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1658,7 +1658,7 @@ case 7: if (json->symbolize_names && json->parsing_name) { *result = rb_str_intern(*result); - } else { + } else if (RB_TYPE_P(*result, T_STRING)) { rb_str_resize(*result, RSTRING_LEN(*result)); } if (cs >= JSON_string_first_final) { diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 29900a4..4c84865 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -553,7 +553,7 @@ 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 { + } else if (RB_TYPE_P(*result, T_STRING)) { rb_str_resize(*result, RSTRING_LEN(*result)); } if (cs >= JSON_string_first_final) { |