Commit 46cc498b authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'd4c2a374'

* commit 'd4c2a374':
  xmv: Add more sanity checks for parameters read from the bitstream

Conflicts:
	libavformat/xmv.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c1840cbd d4c2a374
......@@ -49,6 +49,8 @@
XMV_AUDIO_ADPCM51_FRONTCENTERLOW | \
XMV_AUDIO_ADPCM51_REARLEFTRIGHT)
#define XMV_BLOCK_ALIGN_SIZE 36
/** A video packet with an XMV file. */
typedef struct XMVVideoPacket {
int stream_index; ///< The decoder stream index for this video packet.
......@@ -199,7 +201,7 @@ static int xmv_read_header(AVFormatContext *s)
packet->bit_rate = packet->bits_per_sample *
packet->sample_rate *
packet->channels;
packet->block_align = 36 * packet->channels;
packet->block_align = XMV_BLOCK_ALIGN_SIZE * packet->channels;
packet->block_samples = 64;
packet->codec_id = ff_wav_codec_get_id(packet->compression,
packet->bits_per_sample);
......@@ -215,7 +217,8 @@ static int xmv_read_header(AVFormatContext *s)
av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
"(0x%04X)\n", packet->flags);
if (!packet->channels || !packet->sample_rate) {
if (!packet->channels || !packet->sample_rate ||
packet->channels >= UINT16_MAX / XMV_BLOCK_ALIGN_SIZE) {
av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %d.\n",
audio_track);
ret = AVERROR_INVALIDDATA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment