summaryrefslogtreecommitdiff
path: root/parse/tok.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-12-19 12:21:10 -0500
committerOri Bernstein <ori@eigenstate.org>2013-12-19 12:21:10 -0500
commitc6fc10168fccc31d8986abfbb7cd87eba5cc4a50 (patch)
treef5a6b05c55f858a20a79ac28b7d9e13f6eac8825 /parse/tok.c
parentc664c75f3317a331afa283e880b14935cf05d4a3 (diff)
downloadmc-c6fc10168fccc31d8986abfbb7cd87eba5cc4a50.tar.gz
Abort on overly long character constants.
Diffstat (limited to 'parse/tok.c')
-rw-r--r--parse/tok.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/parse/tok.c b/parse/tok.c
index c5f46bb..43a53ff 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -344,6 +344,8 @@ static uint32_t readutf(char c, char **buf, size_t *buflen, size_t *sz) {
len = 3;
else if ((c & 0xf8) == 0xf0)
len = 4;
+ else
+ fatal(line, "Invalid utf8 encoded character constant");
val = c & ((1 << (8 - len)) - 1);
append(buf, buflen, sz, c);