VirtualBox

Changeset 49426 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 8, 2013 4:34:34 PM (11 years ago)
Author:
vboxsync
Message:

VMMDev: check parameter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r48070 r49426  
    836836}
    837837
     838static int vmmdevVerifyPointerShape(VMMDevReqMousePointer *pReq)
     839{
     840    /* Should be enough for most mouse pointers. */
     841    if (pReq->width > 8192 || pReq->height > 8192)
     842        return VERR_INVALID_PARAMETER;
     843
     844    uint32_t cbShape = (pReq->width + 7) / 8 * pReq->height; /* size of the AND mask */
     845    cbShape = ((cbShape + 3) & ~3) + pReq->width * 4 * pReq->height; /* + gap + size of the XOR mask */
     846    if (RT_UOFFSETOF(VMMDevReqMousePointer, pointerData) + cbShape > pReq->header.size)
     847        return VERR_INVALID_PARAMETER;
     848
     849    return VINF_SUCCESS;
     850}
    838851
    839852/**
     
    871884    if (fShape)
    872885    {
     886        int rc = vmmdevVerifyPointerShape(pReq);
     887        if (RT_FAILURE(rc))
     888            return rc;
     889
    873890        pThis->pDrv->pfnUpdatePointerShape(pThis->pDrv,
    874891                                           fVisible,
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