aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/smacker.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-21 11:42:55 -0400
committerReinhard Tartler <siretart@tauware.de>2012-03-18 17:50:43 +0100
commitb3d7fffee3bf0e2b28ce98ba609b7fd2099938db (patch)
tree447c4392e164a4c9dd1d88e1f5476558721547b1 /libavcodec/smacker.c
parentef7a4df4584db51a97edea3b1140661faf4ddf56 (diff)
downloadffmpeg-b3d7fffee3bf0e2b28ce98ba609b7fd2099938db.tar.gz
smacker: check buffer size before reading output size
(cherry picked from commit cf044f8bff0d28dbc34492f18b0d18b3ba8bad9d) Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r--libavcodec/smacker.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 33ea7b95d6..f3c59da7db 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -586,6 +586,11 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
int bits, stereo;
int pred[2] = {0, 0};
+ if (buf_size <= 4) {
+ av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
+ return AVERROR(EINVAL);
+ }
+
unp_size = AV_RL32(buf);
init_get_bits(&gb, buf + 4, (buf_size - 4) * 8);