VirtualBox

Changeset 85941 in vbox for trunk/src/VBox/Storage


Ignore:
Timestamp:
Aug 28, 2020 7:41:03 PM (4 years ago)
Author:
vboxsync
Message:

Main: bugref:9224: VD.cpp: Added assertions checking for NULL pointer. Added check for flags VD_VMDK_IMAGE_FLAGS_RAWDISK and VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED

Location:
trunk/src/VBox/Storage
Files:
2 edited

Legend:

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

    r85121 r85941  
    62266226        /* sanity check */
    62276227        AssertPtrBreakStmt(pDisk, rc = VERR_INVALID_PARAMETER);
     6228        AssertPtrBreakStmt(pszBackend, rc = VERR_INVALID_PARAMETER);
     6229        AssertPtrBreakStmt(pszFilename, rc = VERR_INVALID_PARAMETER);
     6230        AssertPtrBreakStmt(pPCHSGeometry, rc = VERR_INVALID_PARAMETER);
     6231        AssertPtrBreakStmt(pLCHSGeometry, rc = VERR_INVALID_PARAMETER);
     6232        AssertPtrBreakStmt(pUuid, rc = VERR_INVALID_PARAMETER);
     6233        AssertPtrBreakStmt(pVDIfsImage, rc = VERR_INVALID_PARAMETER);
     6234        AssertPtrBreakStmt(pVDIfsOperation, rc = VERR_INVALID_PARAMETER);
     6235
    62286236        AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature));
    62296237
     
    62356243                           ("pszFilename=%#p \"%s\"\n", pszFilename, pszFilename),
    62366244                           rc = VERR_INVALID_PARAMETER);
    6237         AssertMsgBreakStmt(cbSize,
     6245        AssertMsgBreakStmt(cbSize || (uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK),
    62386246                           ("cbSize=%llu\n", cbSize),
    62396247                           rc = VERR_INVALID_PARAMETER);
    6240         if (cbSize % 512)
     6248        if (cbSize % 512 && !(uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK))
    62416249        {
    62426250            rc = vdError(pDisk, VERR_VD_INVALID_SIZE, RT_SRC_POS,
     
    62486256                           ("uImageFlags=%#x\n", uImageFlags),
    62496257                           rc = VERR_INVALID_PARAMETER);
     6258        AssertMsgBreakStmt(   !(uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK)
     6259                           || !(uImageFlags & ~(VD_VMDK_IMAGE_FLAGS_RAWDISK | VD_IMAGE_FLAGS_FIXED)),
     6260                           ("uImageFlags=%#x\n", uImageFlags),
     6261                           rc = VERR_INVALID_PARAMETER);
    62506262        /* The PCHS geometry fields may be 0 to leave it for later. */
    6251         AssertMsgBreakStmt(   VALID_PTR(pPCHSGeometry)
     6263        AssertMsgBreakStmt(   VALID_PTR(pPCHSGeometry) /** @todo r=bird: will crash in assert message formatting if invalid. duh. */
    62526264                           && pPCHSGeometry->cHeads <= 16
    62536265                           && pPCHSGeometry->cSectors <= 63,
     
    62576269                           rc = VERR_INVALID_PARAMETER);
    62586270        /* The LCHS geometry fields may be 0 to leave it to later autodetection. */
    6259         AssertMsgBreakStmt(   VALID_PTR(pLCHSGeometry)
     6271        AssertMsgBreakStmt(   VALID_PTR(pLCHSGeometry) /** @todo r=bird: will crash in assert message formatting if invalid. duh. */
    62606272                           && pLCHSGeometry->cHeads <= 255
    62616273                           && pLCHSGeometry->cSectors <= 63,
     
    63366348        if (   (   (uImageFlags & VD_VMDK_IMAGE_FLAGS_SPLIT_2G)
    63376349                && !(pImage->Backend->uBackendCaps & VD_CAP_CREATE_SPLIT_2G))
    6338             || (   (uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED)
     6350            || (   (uImageFlags & (  VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED
     6351                                   | VD_VMDK_IMAGE_FLAGS_RAWDISK))
    63396352                && RTStrICmp(pszBackend, "VMDK")))
    63406353        {
  • trunk/src/VBox/Storage/testcase/Makefile.kmk

    r85378 r85941  
    111111 vbox-img_TEMPLATE = VBoxR3Static
    112112 vbox-img_DEFS += IN_VBOXDDU IN_VBOXDDU_STATIC VBOX_HDD_NO_DYNAMIC_BACKENDS
     113 vbox-img_INCS += \
     114        ../../Main/include
    113115 vbox-img_SOURCES = \
    114116        vbox-img.cpp \
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