Message-ID: <email address hidden> Date: Mon, 20 Sep 2004 10:22:14 +0200 From: Bastian Blank <email address hidden> To: Steve Langasek <email address hidden>, <email address hidden> Subject: Re: Bug#272136: More progress about the "Arabic crash" in Debian Installer
--X3gaHHMYHkYqP6yf Content-Type: multipart/mixed; boundary="osDK9TLjxFScVI/L" Content-Disposition: inline
--osDK9TLjxFScVI/L Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable
On Mon, Sep 20, 2004 at 12:49:57AM -0700, Steve Langasek wrote: > Please try the attached patch to slang.
I did some cleanups on the patch.
Bastian
--=20 Insufficient facts always invite danger. -- Spock, "Space Seed", stardate 3141.9
--osDK9TLjxFScVI/L Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=diff Content-Transfer-Encoding: quoted-printable
diff -ur slang-1.4.9.orig/src/slsmg.c slang-1.4.9-utf8/src/slsmg.c --- slang-1.4.9.orig/src/slsmg.c 2004-09-20 09:17:58.000000000 +0200 +++ slang-1.4.9-utf8/src/slsmg.c 2004-09-20 10:10:44.000000000 +0200 @@ -309,7 +309,8 @@ if ((int) n < 0) return; =20 - wptr =3D (wchar_t *)malloc(sizeof(wchar_t)*(n+1)); + size_t wptr_len =3D n; + wptr =3D malloc(sizeof(wchar_t) * wptr_len); =20 if (str !=3D NULL && wptr !=3D NULL) { @@ -328,6 +329,14 @@ str +=3D k; n -=3D w; i++; + /* We have some null-width chars in the string and need more = space */ + if (i >=3D wptr_len - 1) { + wchar_t *new_wptr =3D realloc(wptr, sizeof(wchar_t) * wpt= r_len * 2); + if (!new_wptr) + break; + wptr_len *=3D 2; + wptr =3D new_wptr; + } } SLsmg_write_nwchars (wptr, i); }
--osDK9TLjxFScVI/L--
--X3gaHHMYHkYqP6yf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iEYEARECAAYFAkFOkzUACgkQnw66O/MvCNHMXACeJ5NH77GHxkASpXtwD8pmubCE VeQAniYyVjTnSopeuXax20Xdnht9NHw5 =v/3b -----END PGP SIGNATURE-----
--X3gaHHMYHkYqP6yf--
Message-ID: <email address hidden>
Date: Mon, 20 Sep 2004 10:22:14 +0200
From: Bastian Blank <email address hidden>
To: Steve Langasek <email address hidden>, <email address hidden>
Subject: Re: Bug#272136: More progress about the "Arabic crash" in Debian Installer
--X3gaHHMYHkYqP6yf "osDK9TLjxFScVI /L" Disposition: inline
Content-Type: multipart/mixed; boundary=
Content-
--osDK9TLjxFScVI/L Disposition: inline Transfer- Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8
Content-
Content-
On Mon, Sep 20, 2004 at 12:49:57AM -0700, Steve Langasek wrote:
> Please try the attached patch to slang.
I did some cleanups on the patch.
Bastian
--=20
Insufficient facts always invite danger.
-- Spock, "Space Seed", stardate 3141.9
--osDK9TLjxFScVI/L Disposition: attachment; filename=diff Transfer- Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8
Content-
Content-
diff -ur slang-1. 4.9.orig/ src/slsmg. c slang-1. 4.9-utf8/ src/slsmg. c 4.9.orig/ src/slsmg. c 2004-09-20 09:17:58.000000000 +0200 4.9-utf8/ src/slsmg. c 2004-09-20 10:10:44.000000000 +0200 sizeof( wchar_t) *(n+1)) ; sizeof( wchar_t) * wptr_len); write_nwchars (wptr, i);
--- slang-1.
+++ slang-1.
@@ -309,7 +309,8 @@
if ((int) n < 0)
return;
=20
- wptr =3D (wchar_t *)malloc(
+ size_t wptr_len =3D n;
+ wptr =3D malloc(
=20
if (str !=3D NULL && wptr !=3D NULL)
{
@@ -328,6 +329,14 @@
str +=3D k;
n -=3D w;
i++;
+ /* We have some null-width chars in the string and need more =
space */
+ if (i >=3D wptr_len - 1) {
+ wchar_t *new_wptr =3D realloc(wptr, sizeof(wchar_t) * wpt=
r_len * 2);
+ if (!new_wptr)
+ break;
+ wptr_len *=3D 2;
+ wptr =3D new_wptr;
+ }
}
SLsmg_
}
--osDK9TLjxFScV I/L--
--X3gaHHMYHkYqP6yf pgp-signature; name="signature .asc" Description: Digital signature Disposition: inline
Content-Type: application/
Content-
Content-
-----BEGIN PGP SIGNATURE-----
OkzUACgkQnw66O/ MvCNHMXACeJ5NH7 7GHxkASpXtwD8pm ubCE euXax20Xdnht9NH w5
Version: GnuPG v1.2.5 (GNU/Linux)
iEYEARECAAYFAkF
VeQAniYyVjTnSop
=v/3b
-----END PGP SIGNATURE-----
--X3gaHHMYHkYqP 6yf--