diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-30 11:18:00 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-30 11:18:00 +0100 |
| commit | 33e955ab91d2f76bd8ea6e12fce215d863f4d7d7 (patch) | |
| tree | 2661521d65ba2bd74b75874f888ec868bea46465 | |
| parent | eb773054e47a30c78a82ed80ad4da7abe9bfb09b (diff) | |
| download | busybox-w32-33e955ab91d2f76bd8ea6e12fce215d863f4d7d7.tar.gz busybox-w32-33e955ab91d2f76bd8ea6e12fce215d863f4d7d7.tar.bz2 busybox-w32-33e955ab91d2f76bd8ea6e12fce215d863f4d7d7.zip | |
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>
| -rw-r--r-- | libbb/time.c | 1 | ||||
| -rw-r--r-- | libbb/unicode.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/libbb/time.c b/libbb/time.c index 86b88a414..74a69eefb 100644 --- a/libbb/time.c +++ b/libbb/time.c | |||
| @@ -250,7 +250,6 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) | |||
| 250 | 250 | ||
| 251 | #if ENABLE_MONOTONIC_SYSCALL | 251 | #if ENABLE_MONOTONIC_SYSCALL |
| 252 | 252 | ||
| 253 | #include <sys/syscall.h> | ||
| 254 | /* Old glibc (< 2.3.4) does not provide this constant. We use syscall | 253 | /* Old glibc (< 2.3.4) does not provide this constant. We use syscall |
| 255 | * directly so this definition is safe. */ | 254 | * directly so this definition is safe. */ |
| 256 | #ifndef CLOCK_MONOTONIC | 255 | #ifndef CLOCK_MONOTONIC |
diff --git a/libbb/unicode.c b/libbb/unicode.c index 79481f159..bfeaef895 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) | |||
| 306 | unsigned first, last; | 306 | unsigned first, last; |
| 307 | 307 | ||
| 308 | first = table[0] >> 2; | 308 | first = table[0] >> 2; |
| 309 | last = first + (table[0] & 3); | 309 | if (ucs < first) |
| 310 | if (ucs < first || ucs > last) | 310 | return 0; |
| 311 | last = (table[max] >> 2) + (table[max] & 3); | ||
| 312 | if (ucs > last) | ||
| 311 | return 0; | 313 | return 0; |
| 312 | 314 | ||
| 313 | min = 0; | 315 | min = 0; |
