aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-06-29 01:56:09 +0200
committerReinhard Tartler <siretart@tauware.de>2013-07-06 10:10:17 +0200
commitbd5ff335ec55daffffc05a3e12ee7824ee84b1b2 (patch)
tree7bdeb85c5c61352964aa4d5da369169c9202599a
parent46e09894acb229fe80691900e3f17edceedfd52b (diff)
downloadffmpeg-bd5ff335ec55daffffc05a3e12ee7824ee84b1b2.tar.gz
wmapro: check the min_samples_per_subframe
Must be at least WMAPRO_BLOCK_MIN_SIZE. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org (cherry picked from commit d4a217a408da4bd63acc02cd8f9ebe378a2ad65a) Signed-off-by: Reinhard Tartler <siretart@tauware.de> Conflicts: libavcodec/wmaprodec.c
-rw-r--r--libavcodec/wmaprodec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 49a02a83c8..1e3d99a941 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -106,6 +106,7 @@
#define WMAPRO_BLOCK_MIN_BITS 6 ///< log2 of min block size
#define WMAPRO_BLOCK_MAX_BITS 12 ///< log2 of max block size
+#define WMAPRO_BLOCK_MIN_SIZE (1 << WMAPRO_BLOCK_MIN_BITS) ///< minimum block size
#define WMAPRO_BLOCK_MAX_SIZE (1 << WMAPRO_BLOCK_MAX_BITS) ///< maximum block size
#define WMAPRO_BLOCK_SIZES (WMAPRO_BLOCK_MAX_BITS - WMAPRO_BLOCK_MIN_BITS + 1) ///< possible block sizes
@@ -335,6 +336,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
+ if (s->min_samples_per_subframe < WMAPRO_BLOCK_MIN_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid minimum block size %i\n",
+ s->max_num_subframes);
+ return AVERROR_INVALIDDATA;
+ }
+
if (s->avctx->sample_rate <= 0) {
av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
return AVERROR_INVALIDDATA;