VirtualBox

Changeset 47026 in vbox for trunk


Ignore:
Timestamp:
Jul 7, 2013 5:12:31 PM (12 years ago)
Author:
vboxsync
Message:

VD.cpp: Don't assert when reading beyond the end of a floppy image. We frequently (boot sector tests for instance) attach images that are smaller than the disk size guessed by the guest. Just return blocks filled with good old F6h for the missing parts of floppies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/VD.cpp

    r46712 r47026  
    79757975        fLockRead = true;
    79767976
    7977         AssertMsgBreakStmt(uOffset + cbRead <= pDisk->cbSize,
    7978                            ("uOffset=%llu cbRead=%zu pDisk->cbSize=%llu\n",
    7979                             uOffset, cbRead, pDisk->cbSize),
    7980                            rc = VERR_INVALID_PARAMETER);
    7981 
    79827977        PVDIMAGE pImage = pDisk->pLast;
    79837978        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
     7979
     7980        if (uOffset + cbRead > pDisk->cbSize)
     7981        {
     7982            /* Floppy images might be smaller than the standard expected by
     7983               the floppy controller code.  So, we won't fail here. */
     7984            AssertMsgBreakStmt(pDisk->enmType == VDTYPE_FLOPPY,
     7985                               ("uOffset=%llu cbRead=%zu pDisk->cbSize=%llu\n",
     7986                                uOffset, cbRead, pDisk->cbSize),
     7987                               rc = VERR_EOF);
     7988            memset(pvBuf, 0xf6, cbRead); /* f6h = format.com filler byte */
     7989            if (uOffset >= pDisk->cbSize)
     7990                break;
     7991            cbRead = pDisk->cbSize - uOffset;
     7992        }
    79847993
    79857994        rc = vdReadHelper(pDisk, pImage, uOffset, pvBuf, cbRead,
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