mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-13 18:40:03 +01:00
adpcm: ADPCM Electronic Arts has always two channels
Fixes half of http://ffmpeg.org/trac/ffmpeg/ticket/794 Adresses CVE-2012-0852 (cherry picked from commitbb5b3940b0) Conflicts: libavcodec/adpcm.c Signed-off-by: Reinhard Tartler <siretart@tauware.de> (cherry picked from commitb581580bd1) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
committed by
Reinhard Tartler
parent
7a5fbe4034
commit
15c819e23f
@@ -678,17 +678,23 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
|
|||||||
static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
||||||
{
|
{
|
||||||
ADPCMContext *c = avctx->priv_data;
|
ADPCMContext *c = avctx->priv_data;
|
||||||
|
unsigned int min_channels = 1;
|
||||||
unsigned int max_channels = 2;
|
unsigned int max_channels = 2;
|
||||||
|
|
||||||
switch(avctx->codec->id) {
|
switch(avctx->codec->id) {
|
||||||
|
case CODEC_ID_ADPCM_EA:
|
||||||
|
min_channels = 2;
|
||||||
|
break;
|
||||||
case CODEC_ID_ADPCM_EA_R1:
|
case CODEC_ID_ADPCM_EA_R1:
|
||||||
case CODEC_ID_ADPCM_EA_R2:
|
case CODEC_ID_ADPCM_EA_R2:
|
||||||
case CODEC_ID_ADPCM_EA_R3:
|
case CODEC_ID_ADPCM_EA_R3:
|
||||||
max_channels = 6;
|
max_channels = 6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(avctx->channels > max_channels){
|
|
||||||
return -1;
|
if (avctx->channels < min_channels || avctx->channels > max_channels) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(avctx->codec->id) {
|
switch(avctx->codec->id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user