VirtualBox

Changeset 76986 in vbox


Ignore:
Timestamp:
Jan 25, 2019 12:23:12 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128397
Message:

Audio/DrvAudioCommon: Some more division by zero checks for the DrvAudioHlpBytesToXXX() functions.

File:
1 edited

Legend:

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

    r76879 r76986  
    12451245    AssertPtrReturn(pProps, 0);
    12461246
     1247    if (!pProps->uHz) /* Prevent division by zero. */
     1248        return 0;
     1249
    12471250    const unsigned cbFrame = PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */);
     1251
     1252    if (!cbFrame) /* Prevent division by zero. */
     1253        return 0;
    12481254
    12491255    uint64_t uTimeMs = ((cbBytes + cbFrame - 1) / cbFrame) * RT_MS_1SEC;
     
    12651271    AssertPtrReturn(pProps, 0);
    12661272
     1273    if (!pProps->uHz) /* Prevent division by zero. */
     1274        return 0;
     1275
    12671276    const unsigned cbFrame = PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */);
     1277
     1278    if (!cbFrame) /* Prevent division by zero. */
     1279        return 0;
    12681280
    12691281    uint64_t uTimeUs = ((cbBytes + cbFrame - 1) / cbFrame) * RT_US_1SEC;
     
    12851297    AssertPtrReturn(pProps, 0);
    12861298
     1299    if (!pProps->uHz) /* Prevent division by zero. */
     1300        return 0;
     1301
    12871302    const unsigned cbFrame = PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */);
     1303
     1304    if (!cbFrame) /* Prevent division by zero. */
     1305        return 0;
    12881306
    12891307    uint64_t uTimeNs = ((cbBytes + cbFrame - 1) / cbFrame) * RT_NS_1SEC;
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