From 6550b9fbe810a91765a40d8a684ebf20c183c628 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 26 Jun 2006 20:20:11 +0000 Subject: =?UTF-8?q?Michael=20Tro=C3=9F=20writes:=20gen=5Fwctype=20segfault?= =?UTF-8?q?s=20on=20my=20system=20when=20optimized=20with=20-O2.=20It=20do?= =?UTF-8?q?es=20work=20without=20optimization,=20even=20-O1=20does=20not?= =?UTF-8?q?=20cause=20the=20segfault.=20=20Problem=20is=20in=20newopt,=20a?= =?UTF-8?q?t=20gen=5Fwctype.c:865:=20=09memcpy(tbl->ti=20+=20i=20*=20block?= =?UTF-8?q?size,=20ti[uniqblock[i]],=20blocksize);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The segfault is caused by the uninitialized variable uniqblock when newopt is called recursively. The attached patch fixes this. --- extra/locale/gen_wctype.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'extra') diff --git a/extra/locale/gen_wctype.c b/extra/locale/gen_wctype.c index c29c1b952..6db285e3a 100644 --- a/extra/locale/gen_wctype.c +++ b/extra/locale/gen_wctype.c @@ -785,6 +785,8 @@ size_t newopt(unsigned char *ut, size_t usize, int shift, table_data *tbl) unsigned char uit[RANGE+1]; int shift2; + memset(uniqblock, 0x00, sizeof(uniqblock)); + ii_save = NULL; blocksize = 1 << shift; numblocks = usize >> shift; -- cgit v1.2.3