[parted-devel] Patch: Fix gpt_read to read all of the partition entries correctly

Matthew S. Harris mharris312 at gmail.com
Fri Jan 9 03:21:21 UTC 2009


On Sun, Dec 21, 2008 at 00:17, Jim Meyering <jim at meyering.net> wrote:
> "Matthew S. Harris" <mharris312 at gmail.com> wrote:
>> Here's my one remaining fix.  Yes, I've been sitting on this one since
>> April 2007 too.  Hopefully it's clear why this one is important.
>
> Thanks!
> I don't want to block on test cases,
> but it'd sure make it easier to take a patch that
> comes with a small test case to exercise/demonstrate the fix.
>
> For example, if you can construct a tiny image,
> describe how to perturb it, and give a parted
> command that misbehaves as a result, yet that works
> with your patch, that'd be great.

I totally appreciate why you're asking, but I'm afraid that I just
don't have any more time to give to the Parted project.  I was sitting
on this fix for 20 months, so realistically you're not going to get
the test cases you want from me.

> Does something already ensure that SizeOfPartitionEntry is sane?
> i.e., what if the on-disk value is invalid?
> Maybe add a sanity check, if there isn't one already.

That's a good idea; I don't remember there being a sanity check.

>> +     ptes = ped_malloc (ptes_sectors * disk->dev->sector_size);
>
> Before doing the malloc, ensure that the product does not overflow,
> e.g.,
>
>  if (xalloc_oversized (ptes_sectors, disk->dev->sector_size)
>      goto ...;

That's a good idea too.

I'm sorry I can't be more helpful.


Matthew



More information about the parted-devel mailing list