aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-04 12:57:38 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-27 23:45:44 +0100
commit94b9e7caaea87a8caee587cf9123ec2e31aacf4b (patch)
tree11859f8c7b5283ec3f3a4aee5f19b296eafd9cf7
parent6ffaf40c02d378c1df8b7d048872f9ba685e42de (diff)
downloadffmpeg-94b9e7caaea87a8caee587cf9123ec2e31aacf4b.tar.gz
brstm: make sure an ADPC chunk was read for adpcm_thp
This fixes NULL pointer dereferencing. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit d7d37c479fa71639650751648275615e979beb33) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavformat/brstm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 6eae9d9e53..7cb1341e45 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -389,6 +389,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
codec->codec_id == AV_CODEC_ID_ADPCM_THP_LE) {
uint8_t *dst;
+ if (!b->adpc) {
+ av_log(s, AV_LOG_ERROR, "adpcm_thp requires ADPC chunk, but none was found.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (size > (INT_MAX - 32 - 4) ||
(32 + 4 + size) > (INT_MAX / codec->channels) ||
(32 + 4 + size) * codec->channels > INT_MAX - 8)