summaryrefslogtreecommitdiff
path: root/libbb/unicode.c
diff options
context:
space:
mode:
authorDenys Vlasenko2020-11-30 11:18:00 +0100
committerDenys Vlasenko2020-11-30 11:18:00 +0100
commit33e955ab91d2f76bd8ea6e12fce215d863f4d7d7 (patch)
tree2661521d65ba2bd74b75874f888ec868bea46465 /libbb/unicode.c
parenteb773054e47a30c78a82ed80ad4da7abe9bfb09b (diff)
downloadbusybox-33e955ab91d2f76bd8ea6e12fce215d863f4d7d7.zip
busybox-33e955ab91d2f76bd8ea6e12fce215d863f4d7d7.tar.gz
unicode: fix handling of short 1-4 char tables
function old new delta in_uint16_table 92 107 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r--libbb/unicode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c
index 79481f1..bfeaef8 100644
--- a/libbb/unicode.c
+++ b/libbb/unicode.c
@@ -306,8 +306,10 @@ static int in_uint16_table(unsigned ucs, const uint16_t *table, unsigned max)
unsigned first, last;
first = table[0] >> 2;
- last = first + (table[0] & 3);
- if (ucs < first || ucs > last)
+ if (ucs < first)
+ return 0;
+ last = (table[max] >> 2) + (table[max] & 3);
+ if (ucs > last)
return 0;
min = 0;