Skip to content

Commit f513863

Browse files
nobumatzbot
authored andcommitted
[ruby/stringio] Unreachable after an invalid argument exception
ruby/stringio@a2aab4721c
1 parent 393c5df commit f513863

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/stringio/stringio.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,10 @@ strio_ungetc(VALUE self, VALUE c)
952952

953953
enc = rb_enc_get(ptr->string);
954954
len = rb_enc_codelen(cc, enc);
955-
if (len <= 0) rb_enc_uint_chr(cc, enc);
955+
if (len <= 0) {
956+
rb_enc_uint_chr(cc, enc); /* to raise an exception */
957+
UNREACHABLE;
958+
}
956959
rb_enc_mbcput(cc, buf, enc);
957960
return strio_unget_bytes(ptr, buf, len);
958961
}

0 commit comments

Comments
 (0)