diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-08-13 22:26:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-08-13 22:26:35 -0700 |
commit | e152f22be647d5f6b4c89cd4cfd639f0482ffbbe (patch) | |
tree | 1462ce0bce79f59c355e42a38d8b6f3ed1d52a1a | |
parent | 83ae6fd08039a96d0b0b897d8a0bc55af6854853 (diff) | |
download | txr-e152f22be647d5f6b4c89cd4cfd639f0482ffbbe.tar.gz txr-e152f22be647d5f6b4c89cd4cfd639f0482ffbbe.tar.bz2 txr-e152f22be647d5f6b4c89cd4cfd639f0482ffbbe.zip |
ffi: check for out-of-range wchar_t.
* ffi.c (ffi_wchar_get): Reject wchar_t values that are
negative or beyond U+10FFFF; do not convert these to
a character.
-rw-r--r-- | ffi.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1369,6 +1369,9 @@ static val ffi_wchar_get(struct txr_ffi_type *tft, mem_t *src, val self) wchar_t c = *coerce(wchar_t *, src); (void) tft; (void) self; + if (c < 0 || c > 0x10FFFF) + uw_throwf(error_s, lit("~a: wchar_t value #x~X is out of character range"), + self, num(c), nao); return chr(c); align_sw_end; } |