Browse Source

Merge commit 'f7e616959aff8706edccdae763c24c897c449f6f'

* commit 'f7e616959aff8706edccdae763c24c897c449f6f':
  electronicarts: Check packet sizes before reading

Conflicts:
	libavformat/electronicarts.c

See: fb1ea777b3
Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.1
Michael Niedermayer 12 years ago
parent
commit
eeeb3c8fa3
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      libavformat/electronicarts.c

+ 8
- 4
libavformat/electronicarts.c View File

@@ -579,12 +579,16 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
case AV_CODEC_ID_ADPCM_EA_R1: case AV_CODEC_ID_ADPCM_EA_R1:
case AV_CODEC_ID_ADPCM_EA_R2: case AV_CODEC_ID_ADPCM_EA_R2:
case AV_CODEC_ID_ADPCM_IMA_EA_EACS: case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
if (pkt->size >= 4)
pkt->duration = AV_RL32(pkt->data);
break;
case AV_CODEC_ID_ADPCM_EA_R3: case AV_CODEC_ID_ADPCM_EA_R3:
if (pkt->size >= 4)
if (pkt->size < 4) {
av_log(s, AV_LOG_ERROR, "Packet is too short\n");
av_free_packet(pkt);
return AVERROR_INVALIDDATA;
}
if (ea->audio_codec == AV_CODEC_ID_ADPCM_EA_R3)
pkt->duration = AV_RB32(pkt->data); pkt->duration = AV_RB32(pkt->data);
else
pkt->duration = AV_RL32(pkt->data);
break; break;
case AV_CODEC_ID_ADPCM_IMA_EA_SEAD: case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
pkt->duration = ret * 2 / ea->num_channels; pkt->duration = ret * 2 / ea->num_channels;


Loading…
Cancel
Save