Skip to content

Commit 167ada8

Browse files
committed
Only attempt to resize strings not other objects
1 parent f9c6de2 commit 167ada8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/json/ext/parser/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ case 7:
16581658

16591659
if (json->symbolize_names && json->parsing_name) {
16601660
*result = rb_str_intern(*result);
1661-
} else {
1661+
} else if (RB_TYPE_P(*result, T_STRING)) {
16621662
rb_str_resize(*result, RSTRING_LEN(*result));
16631663
}
16641664
if (cs >= JSON_string_first_final) {

ext/json/ext/parser/parser.rl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
553553

554554
if (json->symbolize_names && json->parsing_name) {
555555
*result = rb_str_intern(*result);
556-
} else {
556+
} else if (RB_TYPE_P(*result, T_STRING)) {
557557
rb_str_resize(*result, RSTRING_LEN(*result));
558558
}
559559
if (cs >= JSON_string_first_final) {

0 commit comments

Comments
 (0)