summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2011-11-24 12:45:29 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2011-11-24 12:45:29 +0000
commit55f32b78e0f125049be0225f913a6fef98b25aa4 (patch)
tree1b96b6664fee071aa035ef273da2282fc348d74e
parent4374e46af8beedc31ee2e0c71ca3a6f30a1954bd (diff)
downloadaports-55f32b78e0f125049be0225f913a6fef98b25aa4.tar.bz2
aports-55f32b78e0f125049be0225f913a6fef98b25aa4.tar.xz
main/ffmpeg: push leftover patch
-rw-r--r--main/ffmpeg/qdm2dec-buffer-overflow.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/main/ffmpeg/qdm2dec-buffer-overflow.patch b/main/ffmpeg/qdm2dec-buffer-overflow.patch
new file mode 100644
index 000000000..5f91aa057
--- /dev/null
+++ b/main/ffmpeg/qdm2dec-buffer-overflow.patch
@@ -0,0 +1,58 @@
+From a6a61a6d1d4da219a6fe29250e2a6b28f9d05524 Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michaelni@gmx.at>
+Date: Fri, 18 Nov 2011 17:48:31 +0100
+Subject: [PATCH] qdm2dec: fix buffer overflow. Fixes NGS00144
+
+This also adds a few lines of code from master that are needed for this fix.
+
+Thanks to Phillip for suggestions to improve the patch.
+Found-by: Phillip Langlois
+Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
+---
+ libavcodec/qdm2.c | 9 +++++++--
+ 1 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
+index 3aa9e5b..e000df8 100644
+--- a/libavcodec/qdm2.c
++++ b/libavcodec/qdm2.c
+@@ -76,6 +76,7 @@ do { \
+ #define SAMPLES_NEEDED_2(why) \
+ av_log (NULL,AV_LOG_INFO,"This file triggers some missing code. Please contact the developers.\nPosition: %s\n",why);
+
++#define QDM2_MAX_FRAME_SIZE 512
+
+ typedef int8_t sb_int8_array[2][30][64];
+
+@@ -168,7 +169,7 @@ typedef struct {
+ /// I/O data
+ const uint8_t *compressed_data;
+ int compressed_size;
+- float output_buffer[1024];
++ float output_buffer[QDM2_MAX_FRAME_SIZE * MPA_MAX_CHANNELS * 2];
+
+ /// Synthesis filter
+ MPADSPContext mpadsp;
+@@ -1822,7 +1823,8 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
+ // something like max decodable tones
+ s->group_order = av_log2(s->group_size) + 1;
+ s->frame_size = s->group_size / 16; // 16 iterations per super block
+- if (s->frame_size > FF_ARRAY_ELEMS(s->output_buffer) / 2)
++
++ if (s->frame_size > QDM2_MAX_FRAME_SIZE)
+ return AVERROR_INVALIDDATA;
+
+ s->sub_sampling = s->fft_order - 7;
+@@ -1893,6 +1895,9 @@ static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
+ int ch, i;
+ const int frame_size = (q->frame_size * q->channels);
+
++ if((unsigned)frame_size > FF_ARRAY_ELEMS(q->output_buffer)/2)
++ return -1;
++
+ /* select input buffer */
+ q->compressed_data = in;
+ q->compressed_size = q->checksum_size;
+--
+1.7.5.4
+