diff options
author | Frank Mehnert <frank.mehnert@kernkonzept.com> | 2024-07-29 13:58:02 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-07-30 02:36:47 +0200 |
commit | 3e6628c847c0c6a6929f14933b029b1261dd6ca9 (patch) | |
tree | 65b18c57cd6d977c6a5aedfd7369941e4e2a5cb2 /libutil | |
parent | 8c9dc43f47ec4f2ab69f5092875638f68659fc8d (diff) |
iconv: fix parameter type of utf8seq_is_{overlong,surrogate,illegal}
Use `unsigned char *s` rather than `char *s`. First, this fixes compiler
warnings when these functions are called from utf8dec_wchar() passing
the `in` pointer of type `unsigned char *`.
Second, these functions are always called with characters >= 0x80 so the
sign bit is set. Shifting right a negative signed value will insert `1`
from the left side, so `foo >> 1` where foo is negative will always have
the sign bit set. So at least "case 2" would never return true.
There is a similar problem with tests like
(*(s+1) >= 0xA0) && (*(s+1) <= 0xBF)
This condition is always false with `char *s`.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
Diffstat (limited to 'libutil')
0 files changed, 0 insertions, 0 deletions