summaryrefslogtreecommitdiff
path: root/libavformat/electronicarts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-23 14:27:09 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-23 14:27:09 +0200
commiteeeb3c8fa3a17c6d3363e68d8219cb8c07397f3b (patch)
tree28e7c6c65095430a7aa444ee8f79a94f49592181 /libavformat/electronicarts.c
parentef7e8efc6befaf02b0953dbbbeb2fc0648b7bb58 (diff)
parentf7e616959aff8706edccdae763c24c897c449f6f (diff)
Merge commit 'f7e616959aff8706edccdae763c24c897c449f6f'
* commit 'f7e616959aff8706edccdae763c24c897c449f6f': electronicarts: Check packet sizes before reading Conflicts: libavformat/electronicarts.c See: fb1ea777b3a01be6d71a103529ad37982707cacc Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/electronicarts.c')
-rw-r--r--libavformat/electronicarts.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 69e4cbf952..b631393113 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -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_R2:
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:
- 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);
+ else
+ pkt->duration = AV_RL32(pkt->data);
break;
case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
pkt->duration = ret * 2 / ea->num_channels;