[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/3] libparted: fix a bug in the hfs probe functions (#714758
From: |
Jim Meyering |
Subject: |
Re: [PATCH 1/3] libparted: fix a bug in the hfs probe functions (#714758) |
Date: |
Sat, 15 Oct 2011 11:29:07 +0200 |
Brian C. Lane wrote:
> From: "Brian C. Lane" <address@hidden>
>
> * libparted/fs/hfs/probe.c (hfsplus_probe): Add a check on the
> search value and reject it if it is negative.
> (hfsx_probe): Same
> (hfs_and_wrapper_probe): Same
> ---
> libparted/fs/hfs/probe.c | 18 +++++++++++-------
> 1 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/libparted/fs/hfs/probe.c b/libparted/fs/hfs/probe.c
> index 8c656cf..bf4d70b 100644
> --- a/libparted/fs/hfs/probe.c
> +++ b/libparted/fs/hfs/probe.c
> @@ -82,7 +82,8 @@ hfs_and_wrapper_probe (PedGeometry* geom)
> + ((PedSector) PED_BE16_TO_CPU (mdb->total_blocks)
> * (PED_BE32_TO_CPU (mdb->block_size) /
> PED_SECTOR_SIZE_DEFAULT )));
> max = search + (PED_BE32_TO_CPU (mdb->block_size) /
> PED_SECTOR_SIZE_DEFAULT);
> - if (!(geom_ret = ped_geometry_new (geom->dev, geom->start, search + 2)))
> + if ((search < 0)
> + || !(geom_ret = ped_geometry_new (geom->dev, geom->start, search +
> 2)))
Hi Brian,
This looks like a fine bug fix.
Can you write a test suite addition that
creates an HFS file system and then corrupts
it in a way that triggers the bug?