Merge pull request #337 from omasanori/char-ascii

Restrict char in the range of ASCII.
This commit is contained in:
Yuichi Nishiwaki 2016-04-01 15:36:29 -07:00
commit dd75267f8e
1 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ pic_char_char_to_integer(pic_state *pic)
char c;
pic_get_args(pic, "c", &c);
assert((c & 0x80) == 0);
return pic_int_value(pic, c);
}
@ -33,7 +34,7 @@ pic_char_integer_to_char(pic_state *pic)
pic_get_args(pic, "i", &i);
if (i < 0 || i > 255) {
if (i < 0 || i > 127) {
pic_error(pic, "integer->char: integer out of char range", 1, pic_int_value(pic, i));
}