From 1d01bc6aaaf7067c8af1ebdcbb9eb2b6fbdea6ad Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 19 Feb 2002 14:25:13 +0000 Subject: [PATCH] Stricter range checking. --- lib/ChangeLog | 4 ++++ lib/utf8-ucs4.h | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index d024d8225..60021165e 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2002-02-17 Bruno Haible + + * utf8-ucs4.h (u8_mbtouc_aux): Stricter range checking. + 2002-02-15 Bruno Haible * config.charset [msdosdjgpp]: For Russian, use CP866. diff --git a/lib/utf8-ucs4.h b/lib/utf8-ucs4.h index f39c9c5e2..a3f28834b 100644 --- a/lib/utf8-ucs4.h +++ b/lib/utf8-ucs4.h @@ -1,5 +1,5 @@ /* Conversion UTF-8 to UCS-4. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001-2002 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -84,7 +84,11 @@ u8_mbtouc_aux (puc, s, n) { if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90)) + && (c >= 0xf1 || s[1] >= 0x90) +#if 1 + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) +#endif + ) { *puc = ((unsigned int) (c & 0x07) << 18) | ((unsigned int) (s[1] ^ 0x80) << 12) -- 2.47.2