[git commit] unicode: fix handling of short 1-4 char tables
Denys Vlasenko
vda.linux at googlemail.com
Mon Nov 30 10:18:00 UTC 2020
commit: https://git.busybox.net/busybox/commit/?id=33e955ab91d2f76bd8ea6e12fce215d863f4d7d7
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
in_uint16_table 92 107 +15
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
libbb/time.c | 1 -
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)
#if ENABLE_MONOTONIC_SYSCALL
-#include <sys/syscall.h>
/* Old glibc (< 2.3.4) does not provide this constant. We use syscall
* directly so this definition is safe. */
#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)
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;
More information about the busybox-cvs
mailing list