Skip to content

Commit

Permalink
Only attempt to resize strings not other objects
Browse files Browse the repository at this point in the history
  • Loading branch information
flori committed Apr 29, 2019
1 parent f9c6de2 commit 167ada8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/json/ext/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion ext/json/ext/parser/parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 167ada8

Please sign in to comment.