summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authornicm <nicm>2020-06-02 11:29:00 +0000
committernicm <nicm>2020-06-02 11:29:00 +0000
commit822ee4e0a64cd27c4668aed53f1284b257612dcb (patch)
tree6572170435ac1d49c4ef7e0d185613eb01bb7ebc /utf8.c
parentf3931497f8aee291bce132fb106cedb55c5b3fa9 (diff)
Fail rather than fatal on UTF-8 width 0.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 2a92003f..893cb5ee 100644
--- a/utf8.c
+++ b/utf8.c
@@ -135,6 +135,8 @@ utf8_from_data(const struct utf8_data *ud, utf8_char *uc)
union utf8_map m = { .uc = 0 };
u_int offset;
+ if (ud->width == 0)
+ goto fail;
if (ud->width != 1 && ud->width != 2)
fatalx("invalid UTF-8 width");
if (ud->size == 0)