Brian C. Lane wrote:
> From: "Brian C. Lane" <[email protected]>
>
> * 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?

_______________________________________________
bug-parted mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to