VirtualBox

Ignore:
Timestamp:
Sep 18, 2014 7:50:17 AM (10 years ago)
Author:
vboxsync
Message:

ps2kLoadQueue: Paraoia, check SSMR3GetU32 return code before using the data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Input/PS2K.cpp

    r51539 r52782  
    537537static int ps2kLoadQueue(PSSMHANDLE pSSM, GeneriQ *pQ)
    538538{
    539     int         rc;
    540 
    541539    /* On load, always put the read pointer at zero. */
    542     SSMR3GetU32(pSSM, &pQ->cUsed);
    543 
    544     LogFlow(("Loading %d items to queue %p\n", pQ->cUsed, pQ));
    545 
    546     if (pQ->cUsed > pQ->cSize)
    547     {
    548         AssertMsgFailed(("Saved size=%u, actual=%u\n", pQ->cUsed, pQ->cSize));
    549         return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
    550     }
     540    int rc = SSMR3GetU32(pSSM, &pQ->cUsed);
     541    AssertRCReturn(rc, rc);
     542    LogFlow(("Loading %u items to queue %p\n", pQ->cUsed, pQ));
     543    AssertMsgReturn(pQ->cUsed <= pQ->cSize, ("Saved size=%u, actual=%u\n", pQ->cUsed, pQ->cSize),
     544                    VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
    551545
    552546    /* Recalculate queue positions and load data in one go. */
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