mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Range check octal-escaped characters
* libguile/read.c (scm_read_character): range check octal escapes
This commit is contained in:
parent
6c2353e1d5
commit
0ffc78e384
1 changed files with 10 additions and 4 deletions
|
@ -848,12 +848,18 @@ scm_read_character (scm_t_wchar chr, SCM port)
|
|||
{
|
||||
/* Dirk:FIXME:: This type of character syntax is not R5RS
|
||||
* compliant. Further, it should be verified that the constant
|
||||
* does only consist of octal digits. Finally, it should be
|
||||
* checked whether the resulting fixnum is in the range of
|
||||
* characters. */
|
||||
* does only consist of octal digits. */
|
||||
SCM p = scm_string_to_number (charname, scm_from_uint (8));
|
||||
if (SCM_I_INUMP (p))
|
||||
return SCM_MAKE_CHAR (SCM_I_INUM (p));
|
||||
{
|
||||
scm_t_wchar c = SCM_I_INUM (p);
|
||||
if (SCM_IS_UNICODE_CHAR (c))
|
||||
return SCM_MAKE_CHAR (c);
|
||||
else
|
||||
scm_i_input_error (FUNC_NAME, port,
|
||||
"out-of-range octal character escape: ~a",
|
||||
scm_list_1 (charname));
|
||||
}
|
||||
}
|
||||
|
||||
/* The names of characters should never have non-Latin1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue