original version by Matt Domsch <Matt_Domsch@dell.com>
Disclaimed into the Public Domain
- Portions Copyright (C) 2001-2003, 2005-2008 Free Software Foundation, Inc.
+ Portions Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
EFI GUID Partition Table handling
Per Intel EFI Specification v1.02
goto error;
if (_read_header (disk->dev, &gpt, 1)) {
- PED_ASSERT ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
- <= disk->dev->length - 1, goto error_free_gpt);
+ /* There used to be a GPT partition table here, with an
+ alternate LBA that extended beyond the current
+ end-of-device. Treat it as a non-match. */
+ if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
+ > disk->dev->length - 1)
+ goto error_free_gpt;
+
if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
< disk->dev->length - 1) {
char* zeros = ped_malloc (pth_get_size (disk->dev));