summaryrefslogtreecommitdiff
path: root/libavformat/brstm.c
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-04 13:19:59 +0100
commitd7d37c479fa71639650751648275615e979beb33 (patch)
treee241ed2c16ceda06d84626565daeaf135966abf4 /libavformat/brstm.c
parente7a7b3135a4e5ba4bd2e144444d95a7563f53e9b (diff)
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>
Diffstat (limited to 'libavformat/brstm.c')
-rw-r--r--libavformat/brstm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index bbdbcef6cb..6ec4d89438 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)