summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-04 11:50:54 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-04 11:58:00 +0200
commit642207d29a4861900cf34f19e8c7ded23ace6075 (patch)
tree244d25293dbd30955058d180253afd136695f58f /libavcodec
parent54d628a580bea7bfcd84461ef6d953c3e09d908a (diff)
parentf7c5883126f9440547933eefcf000aa78af4821c (diff)
Merge commit 'f7c5883126f9440547933eefcf000aa78af4821c'
* commit 'f7c5883126f9440547933eefcf000aa78af4821c': alac: Limit max_samples_per_frame See: 3920d1387834e2bc334aff9f518f4beb24e470bd Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/alac.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 6ffc00634f..c714d40841 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -511,11 +511,7 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
static int allocate_buffers(ALACContext *alac)
{
int ch;
- int buf_size;
-
- if (alac->max_samples_per_frame > INT_MAX / sizeof(int32_t))
- goto buf_alloc_fail;
- buf_size = alac->max_samples_per_frame * sizeof(int32_t);
+ int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
@@ -546,7 +542,8 @@ static int alac_set_info(ALACContext *alac)
bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
alac->max_samples_per_frame = bytestream2_get_be32u(&gb);
- if (!alac->max_samples_per_frame || alac->max_samples_per_frame > INT_MAX) {
+ if (!alac->max_samples_per_frame ||
+ alac->max_samples_per_frame > INT_MAX / sizeof(int32_t)) {
av_log(alac->avctx, AV_LOG_ERROR, "max samples per frame invalid: %u\n",
alac->max_samples_per_frame);
return AVERROR_INVALIDDATA;