VirtualBox

Ignore:
Timestamp:
Jun 26, 2008 6:26:34 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32413
Message:

Fix incorrect 63 sector minimum logical partition start offset. Also separate sorting from consistency checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r9891 r9975  
    568568            pCP->uEndSector = p[6] & 0x3f;
    569569            uint32_t uStartOffset = RT_MAKE_U32_FROM_U8(p[8], p[9], p[10], p[11]);
     570            if (!uStartOffset)
     571            {
     572                RTPrintf("Invalid partition start offset. Aborting\n");
     573                return VERR_INVALID_PARAMETER;
     574            }
    570575            pCP->uStart = uStart + uOffset + uStartOffset;
    571576            pCP->uSize = RT_MAKE_U32_FROM_U8(p[12], p[13], p[14], p[15]);
    572577            /* Fill out partitioning location info for EBR. */
    573578            pCP->uPartDataStart = uStart + uOffset;
    574             pCP->cPartDataSectors = RT_MIN(uStartOffset, 63);
     579            pCP->cPartDataSectors = uStartOffset;
    575580            p += 16;
    576581            if (p[4] == 0)
     
    589594    }
    590595
    591     /* Sort partitions in ascending order of start sector. Also do a lot of
    592      * consistency checking. */
    593     uint64_t uPrevEnd = 0;
     596    /* Sort partitions in ascending order of start sector, plus a trivial
     597     * bit of consistency checking. */
    594598    for (unsigned i = 0; i < pPart->cPartitions-1; i++)
    595599    {
     
    623627                   &pPart->aPartitions[pPart->cPartitions], sizeof(HOSTPARTITION));
    624628        }
     629    }
     630
     631    /* Now do a lot of consistency checking. */
     632    uint64_t uPrevEnd = 0;
     633    for (unsigned i = 0; i < pPart->cPartitions-1; i++)
     634    {
    625635        if (pPart->aPartitions[i].cPartDataSectors)
    626636        {
     
    643653    /* Fill out partitioning location info for MBR. */
    644654    pPart->aPartitions[0].uPartDataStart = 0;
    645     pPart->aPartitions[0].cPartDataSectors = RT_MIN(pPart->aPartitions[0].uStart, 63);
     655    pPart->aPartitions[0].cPartDataSectors = pPart->aPartitions[0].uStart;
    646656
    647657    return VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette