فهرست منبع

Michael Troß writes:
gen_wctype segfaults on my system when optimized with -O2. It does work
without optimization, even -O1 does not cause the segfault. Problem is in
newopt, at gen_wctype.c:865:
memcpy(tbl->ti + i * blocksize, ti[uniqblock[i]], blocksize);

The segfault is caused by the uninitialized variable uniqblock when
newopt is called recursively. The attached patch fixes this.

Mike Frysinger 20 سال پیش
والد
کامیت
6550b9fbe8
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  1. 2 0
      extra/locale/gen_wctype.c

+ 2 - 0
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;