From: Ulrich Drepper Date: Sun, 23 Jan 2000 08:31:07 +0000 (+0000) Subject: Fix two problems in UTF-8 decoder. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a143082579f17e84771ae45ec5a369276d509a7d;p=thirdparty%2Fglibc.git Fix two problems in UTF-8 decoder. --- diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c index 74dbfc0356a..7662b240612 100644 --- a/iconv/gconv_simple.c +++ b/iconv/gconv_simple.c @@ -1,5 +1,5 @@ /* Simple transformations functions. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -255,8 +255,11 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend, } \ else \ { \ - if ((ch & 0xe0) == 0xc0) \ + if (ch >= 0xc2 && ch < 0xe0) \ { \ + /* We expect two bytes. The first byte cannot be 0xc0 or 0xc1, \ + otherwise the wide character could have been represented \ + using a single byte. */ \ cnt = 2; \ ch &= 0x1f; \ } \