ソースを参照

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;