From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NbO4p-0004cS-3k for mharc-grub-devel@gnu.org; Sat, 30 Jan 2010 19:54:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NbO4m-0004cF-TB for grub-devel@gnu.org; Sat, 30 Jan 2010 19:54:08 -0500 Received: from [199.232.76.173] (port=56827 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NbO4m-0004c5-Fz for grub-devel@gnu.org; Sat, 30 Jan 2010 19:54:08 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NbO4l-0005aZ-Jr for grub-devel@gnu.org; Sat, 30 Jan 2010 19:54:08 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:59516) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NbO4l-0005aM-8v for grub-devel@gnu.org; Sat, 30 Jan 2010 19:54:07 -0500 Received: by bwz7 with SMTP id 7so1854195bwz.26 for ; Sat, 30 Jan 2010 16:54:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:x-enigmail-version:content-type; bh=k0JXBDeJ3oTmSW6t8SGLsjMrs62pFFvPSkF4JGU4bQU=; b=aySaNhXY/cMXUkS6RdXzU4/1VJI3CSASlV7t/KhOBFN29+bfTrRDgTtfQszgQwlDFD PV1fsIQJSnmhHcexSdDMZge8Xby0hvmoaNFb/pKYX9DRoQrStWsYxFDo/hGcuUt1UuUQ MUKglEXaV7Yi7nciiqGDKY/XOHMHNKqGBP6gc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; b=o4JfLXI1VjjrX3BhnCLUGvxEil6lGnDV+w3BmQ1EarZuPr36kNocGFFacpPHaro0EI Aeyq3ol/cucP+ByiNva39S1tjv4L4rw4fo6vAkYI6o/6BPsQfVfHkx/YsHnqIr3Kgr0x SxI99zaj21H36D0EEwa5QbBd0oc024wW3oFNI= Received: by 10.204.143.130 with SMTP id v2mr1994768bku.7.1264899245705; Sat, 30 Jan 2010 16:54:05 -0800 (PST) Received: from debian.bg45.phnet (gprs45.swisscom-mobile.ch [193.247.250.45]) by mx.google.com with ESMTPS id 14sm1514167bwz.9.2010.01.30.16.54.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 30 Jan 2010 16:54:05 -0800 (PST) Message-ID: <4B64D4A0.9080607@gmail.com> Date: Sun, 31 Jan 2010 01:53:52 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GRUB 2 X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigF011BBB8DBD82D1CF73990DC" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [PATCH] Don't discard valid UTF-8 following non-valid one X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2010 00:54:09 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF011BBB8DBD82D1CF73990DC Content-Type: multipart/mixed; boundary="------------010701090304000608050009" This is a multi-part message in MIME format. --------------010701090304000608050009 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable This discarding is Unicode-uncompliant and can create problems like accidental discarding of \0 in some cases --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------010701090304000608050009 Content-Type: text/x-diff; name="nodiscard.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="nodiscard.diff" =3D=3D=3D modified file 'ChangeLog' --- ChangeLog 2010-01-31 00:26:11 +0000 +++ ChangeLog 2010-01-31 00:50:47 +0000 @@ -1,5 +1,11 @@ 2010-01-31 Vladimir Serbinenko =20 + * kern/misc.c (grub_utf8_to_ucs4): Don't eat valid characters preceeded= + by non-valid ones. + * kern/term.c (grub_putchar): Likewise. + +2010-01-31 Vladimir Serbinenko + * font/font.c (find_glyph): Check that bmp_idx is available before using it. (grub_font_get_string_width): Never call grub_font_get_glyph_internal =3D=3D=3D modified file 'kern/misc.c' --- kern/misc.c 2010-01-20 08:12:47 +0000 +++ kern/misc.c 2010-01-31 00:35:13 +0000 @@ -975,6 +975,10 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest,=20 { /* invalid */ code =3D '?'; + /* Character c may be valid, don't eat it. */ + src--; + if (srcsize !=3D (grub_size_t)-1) + srcsize++; count =3D 0; } else =3D=3D=3D modified file 'kern/term.c' --- kern/term.c 2010-01-10 12:34:48 +0000 +++ kern/term.c 2010-01-31 00:49:09 +0000 @@ -57,16 +57,17 @@ grub_putchar (int c) { static grub_size_t size =3D 0; static grub_uint8_t buf[6]; + grub_uint8_t *rest; grub_uint32_t code; - grub_size_t ret; =20 buf[size++] =3D c; - ret =3D grub_utf8_to_ucs4 (&code, 1, buf, size, 0); =20 - if (ret !=3D 0) + while (grub_utf8_to_ucs4 (&code, 1, buf, size, (const grub_uint8_t **)= &rest)=20 + !=3D 0) { struct grub_term_output *term; - size =3D 0; + size -=3D rest - buf; + grub_memmove (buf, rest, size); FOR_ACTIVE_TERM_OUTPUTS(term) grub_putcode (code, term); if (code =3D=3D '\n' && grub_newline_hook) --------------010701090304000608050009-- --------------enigF011BBB8DBD82D1CF73990DC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAktk1KcACgkQNak7dOguQgkSgwD9FajEbGYjackbOsf7Xf+O3twG ZrEcpF+RoWJg7oIrGscBAKGhM5DStlxGvJAWeAAyVOeUyhO5sJ3IYyrOQDiIawVI =OOMI -----END PGP SIGNATURE----- --------------enigF011BBB8DBD82D1CF73990DC--