VirtualBox

Ignore:
Timestamp:
Dec 5, 2022 8:16:42 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154803
Message:

HostServices/common: Resolved a @todo (use VMMDEV_MAX_HGCM_PARMS); don't (debug) assert for messages with 0 parameters (those are valid); this otherwise would lead to an initialized message with message type 0, which doesn't make any sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/common/message.cpp

    r96407 r97742  
    2727
    2828#include <VBox/HostServices/Service.h>
     29#include <VBox/VMMDev.h> /* For VMMDEV_MAX_HGCM_PARMS. */
    2930
    3031using namespace HGCM;
     
    99100        return VERR_INVALID_PARAMETER;
    100101    }
     102
     103    if (m_cParms == 0) /* Nothing to copy, take a shortcut. */
     104        return VINF_SUCCESS;
     105
    101106    if (m_cParms > cParms)
    102107    {
     
    268273int Message::initData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) RT_NOEXCEPT
    269274{
    270     /** @todo r=bird: There is a define for the max number of HGCM parameters,
    271      *        it's way smaller than 256, something like 61 IIRC. */
    272     AssertReturn(cParms < 256, VERR_INVALID_PARAMETER);
    273     AssertPtrReturn(aParms, VERR_INVALID_PARAMETER);
     275    AssertReturn(cParms < VMMDEV_MAX_HGCM_PARMS, VERR_INVALID_PARAMETER);
     276    AssertReturn(cParms == 0 || aParms != NULL, VERR_INVALID_POINTER);
    274277
    275278    /* Cleanup any eventual old stuff. */
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