On Fri, Feb 08, 2019 at 11:03:55PM +0000, Mike Small wrote: > Hi, > > Someone shared with me a case where parted 3.2 (3.2-15 as packaged in > Ubuntu Xenial) hit a sigsegv when run as follows:
Good job tracking this down! Yes, a test would be good to have, I think this is one of those corner cases that can bite people and lead to lots of confusion :) > crc = __efi_crc32(sb, sumoff, PED_LE32_TO_CPU(sb->s_crc_seed)); > @@ -113,11 +113,13 @@ nilfs2_probe (PedGeometry* geom) > const int sectors = (4096 + geom->dev->sector_size - 1) / > geom->dev->sector_size; > char *buf = alloca (sectors * geom->dev->sector_size); > - void *buff2 = alloca (geom->dev->sector_size); > + const int sectors2 = sizeof(struct nilfs2_super_block) / > geom->dev->sector_size + > + (sizeof(struct nilfs2_super_block) % geom->dev->sector_size > == 0) ? 0 : 1; This calculation is correct, but I find it hard to read. If you use the same technique as it does for sectors it would be easier to understand in the future, and I don't think the superblock size is going to change. -- Brian C. Lane (PST8PDT)