X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fbrstm.c;h=aae2575fb73e25184589fc41c7029e4dd0dbee8e;hb=4f32ccb61800ef1a0acf02010784da4f15adde44;hp=bbdbcef6cbe31274e144bef83227fc2a09d640a6;hpb=10e075c138467b1fbe63cd9eec0dfd2c18cf903a;p=ffmpeg diff --git a/libavformat/brstm.c b/libavformat/brstm.c index bbdbcef6cbe..aae2575fb73 100644 --- a/libavformat/brstm.c +++ b/libavformat/brstm.c @@ -389,6 +389,16 @@ 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 (!b->table) { + b->table = av_mallocz(32 * codec->channels); + if (!b->table) + return AVERROR(ENOMEM); + } + if (size > (INT_MAX - 32 - 4) || (32 + 4 + size) > (INT_MAX / codec->channels) || (32 + 4 + size) * codec->channels > INT_MAX - 8)