Message-ID: <email address hidden> Date: Mon, 20 Sep 2004 00:49:57 -0700 From: Steve Langasek <email address hidden> To: <email address hidden> Subject: Re: More progress about the "Arabic crash" in Debian Installer
--Ms5iOKSBOB9YS8zC Content-Type: multipart/mixed; boundary="fLj60tP2PZ34xyqD" Content-Disposition: inline
--fLj60tP2PZ34xyqD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable
Please try the attached patch to slang.
Thanks, --=20 Steve Langasek postmodern programmer
--fLj60tP2PZ34xyqD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="slang-272136.diff" Content-Transfer-Encoding: quoted-printable
diff -uNr slang-1.4.9/src/slsmg.c ../build-tree.new/slang-1.4.9-utf8/src/sl= smg.c --- slang-1.4.9/src/slsmg.c 2004-09-20 00:45:46.000000000 -0700 +++ ../build-tree.new/slang-1.4.9-utf8/src/slsmg.c 2004-09-20 00:41:14.0000= 00000 -0700 @@ -304,12 +304,13 @@ char blank =3D ' '; mbstate_t mbstate; wchar_t *wptr; + int cellsleft =3D n; =20 /* Avoid a problem if a user accidently passes a negative value */ if ((int) n < 0) return; =20 - wptr =3D (wchar_t *)malloc(sizeof(wchar_t)*(n+1)); + wptr =3D (wchar_t *)malloc(sizeof(wchar_t)*n); =20 if (str !=3D NULL && wptr !=3D NULL) { @@ -323,15 +324,18 @@ k !=3D (size_t)(-2)) { w =3D wcwidth(wptr[i]); - if (w < 0 || w > n) + if (w < 0 || w > cellsleft) break; str +=3D k; - n -=3D w; + cellsleft -=3D w; i++; + if (i >=3D n) { + wptr =3D realloc(wptr,sizeof(wchar_t)*(i+1)); + } } SLsmg_write_nwchars (wptr, i); } - while (n-- > 0) SLsmg_write_nchars (&blank, 1); + while (cellsleft-- > 0) SLsmg_write_nchars (&blank, 1); if (wptr) free(wptr); } #else
--fLj60tP2PZ34xyqD--
--Ms5iOKSBOB9YS8zC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBToujKN6ufymYLloRAkDbAKDQpblZ3Q0r0cCN2tG2jgL4RRKbgwCgq2Sz sFHQufpodTUksB6OCoycs7Q= =5mnG -----END PGP SIGNATURE-----
--Ms5iOKSBOB9YS8zC--
Message-ID: <email address hidden>
Date: Mon, 20 Sep 2004 00:49:57 -0700
From: Steve Langasek <email address hidden>
To: <email address hidden>
Subject: Re: More progress about the "Arabic crash" in Debian Installer
--Ms5iOKSBOB9YS8zC "fLj60tP2PZ34xy qD" Disposition: inline
Content-Type: multipart/mixed; boundary=
Content-
--fLj60tP2PZ34xyqD Disposition: inline Transfer- Encoding: quoted-printable
Content-Type: text/plain; charset=us-ascii
Content-
Content-
Please try the attached patch to slang.
Thanks,
--=20
Steve Langasek
postmodern programmer
--fLj60tP2PZ34xyqD Disposition: attachment; filename= "slang- 272136. diff" Transfer- Encoding: quoted-printable
Content-Type: text/plain; charset=us-ascii
Content-
Content-
diff -uNr slang-1. 4.9/src/ slsmg.c ../build- tree.new/ slang-1. 4.9-utf8/ src/sl= 4.9/src/ slsmg.c 2004-09-20 00:45:46.000000000 -0700 tree.new/ slang-1. 4.9-utf8/ src/slsmg. c 2004-09-20 00:41:14.0000= sizeof( wchar_t) *(n+1)) ; sizeof( wchar_t) *n); wptr,sizeof( wchar_t) *(i+1)) ; write_nwchars (wptr, i);
smg.c
--- slang-1.
+++ ../build-
00000 -0700
@@ -304,12 +304,13 @@
char blank =3D ' ';
mbstate_t mbstate;
wchar_t *wptr;
+ int cellsleft =3D n;
=20
/* Avoid a problem if a user accidently passes a negative value */
if ((int) n < 0)
return;
=20
- wptr =3D (wchar_t *)malloc(
+ wptr =3D (wchar_t *)malloc(
=20
if (str !=3D NULL && wptr !=3D NULL)
{
@@ -323,15 +324,18 @@
k !=3D (size_t)(-2))
{
w =3D wcwidth(wptr[i]);
- if (w < 0 || w > n)
+ if (w < 0 || w > cellsleft)
break;
str +=3D k;
- n -=3D w;
+ cellsleft -=3D w;
i++;
+ if (i >=3D n) {
+ wptr =3D realloc(
+ }
}
SLsmg_
}
- while (n-- > 0) SLsmg_write_nchars (&blank, 1);
+ while (cellsleft-- > 0) SLsmg_write_nchars (&blank, 1);
if (wptr) free(wptr);
}
#else
--fLj60tP2PZ34x yqD--
--Ms5iOKSBOB9YS8zC pgp-signature; name="signature .asc" Description: Digital signature Disposition: inline
Content-Type: application/
Content-
Content-
-----BEGIN PGP SIGNATURE-----
ufymYLloRAkDbAK DQpblZ3Q0r0cCN2 tG2jgL4RRKbgwCg q2Sz OCoycs7Q=
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBToujKN6
sFHQufpodTUksB6
=5mnG
-----END PGP SIGNATURE-----
--Ms5iOKSBOB9YS 8zC--