GNU bug report logs - #34392
[PATCH] Avoid sigsegv in case 2nd nilfs2 superblock magic accidently found.

Previous Next

Package: parted;

Reported by: Mike Small <smallm <at> sdf.org>

Date: Fri, 8 Feb 2019 23:12:01 UTC

Severity: normal

Tags: patch

Done: "Brian C. Lane" <bcl <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 34392 <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: Mike Small <smallm <at> sdf.org>
Cc: 34392 <at> debbugs.gnu.org
Subject: Re: bug#34392: [PATCH] Avoid sigsegv in case 2nd nilfs2 superblock
 magic accidently found.
Date: Mon, 11 Feb 2019 11:59:31 -0800
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)




This bug report was last modified 6 years and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.