Ignore:
Timestamp:
07/28/11 21:51:30 (13 years ago)
Author:
r2d
Message:

Security fixes by DEATH (and some changes by myself)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcdec/streaminfo.c

    r443 r473  
    100100{
    101101        if (si->max_band == 0 || si->max_band >= 32
    102             || si->channels > 2)
    103                 return MPC_STATUS_FILE;
     102            || si->channels > 2 || si->channels == 0 || si->sample_freq == 0)
     103                return MPC_STATUS_FAIL;
    104104        return MPC_STATUS_OK;
    105105}
     
    156156
    157157        if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH;
     158        else if (last_frame_samples > MPC_FRAME_LENGTH) return MPC_STATUS_FAIL;
    158159        si->samples = (mpc_int64_t) frames * MPC_FRAME_LENGTH;
    159160        if (si->is_true_gapless)
     
    192193        CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16);
    193194        if (CRC != mpc_crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4))
    194                 return MPC_STATUS_FILE;
     195                return MPC_STATUS_FAIL;
    195196
    196197        si->stream_version = mpc_bits_read(&r, 8);
    197198        if (si->stream_version != 8)
    198                 return MPC_STATUS_INVALIDSV;
     199                return MPC_STATUS_FAIL;
    199200
    200201        mpc_bits_get_size(&r, &si->samples);
Note: See TracChangeset for help on using the changeset viewer.