瀏覽代碼

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 18 年之前
父節點
當前提交
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;