VirtualBox

Changeset 71747 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 8, 2018 2:34:55 PM (7 years ago)
Author:
vboxsync
Message:

DevSB16: mixer_regs should be 'uint8_t' rather than 'int', this way it cannot ever be out of bounds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r71746 r71747  
    212212
    213213    /* mixer state */
    214     int mixer_nreg;
     214    uint8_t mixer_nreg;
    215215    uint8_t mixer_regs[256];
    216216} SB16STATE, *PSB16STATE;
     
    15481548}
    15491549
    1550 static int mixer_write_indexb(PSB16STATE pThis, uint32_t val)
     1550static int mixer_write_indexb(PSB16STATE pThis, uint8_t val)
    15511551{
    15521552    pThis->mixer_nreg = val;
     
    21762176    SSMR3GetS32(pSSM, &pThis->csp_reg83w);
    21772177
    2178     SSMR3GetMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
    2179     SSMR3GetMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
     2178    SSMR3GetMem(pSSM, pThis->in2_data, sizeof(pThis->in2_data));
     2179    SSMR3GetMem(pSSM, pThis->out_data, sizeof(pThis->out_data));
    21802180    SSMR3GetU8 (pSSM, &pThis->test_reg);
    21812181    SSMR3GetU8 (pSSM, &pThis->last_read_byte);
     
    21872187    SSMR3GetS32(pSSM, &pThis->align);
    21882188
    2189     SSMR3GetS32(pSSM, &pThis->mixer_nreg);
    2190     SSMR3GetMem(pSSM, pThis->mixer_regs, 256);
     2189    int32_t mixer_nreg = 0;
     2190    int rc = SSMR3GetS32(pSSM, &mixer_nreg);
     2191    AssertRCReturn(rc, rc);
     2192    pThis->mixer_nreg = (uint8_t)mixer_nreg;
     2193    rc = SSMR3GetMem(pSSM, pThis->mixer_regs, 256);
     2194    AssertRCReturn(rc, rc);
    21912195
    21922196#if 0
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