]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix two problems in UTF-8 decoder.
authorUlrich Drepper <drepper@redhat.com>
Sun, 23 Jan 2000 08:31:07 +0000 (08:31 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 23 Jan 2000 08:31:07 +0000 (08:31 +0000)
iconv/gconv_simple.c

index 74dbfc0356a98edc28e5ece2d7e4b8c4dadffe8a..7662b240612222767c821b295e9cfb65f6583ff8 100644 (file)
@@ -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 <drepper@cygnus.com>, 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;                                                       \
          }                                                                   \