[FFmpeg-cvslog] smacker: check buffer size before reading output size

Justin Ruggles git at videolan.org
Fri Nov 4 13:22:19 CET 2011


ffmpeg | branch: release/0.8 | Justin Ruggles <justin.ruggles at gmail.com> | Wed Sep 21 11:42:55 2011 -0400| [e6b225532933655d95266ce772b8a45b14aa27ec] | committer: Michael Niedermayer

smacker: check buffer size before reading output size
(cherry picked from commit cf044f8bff0d28dbc34492f18b0d18b3ba8bad9d)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6b225532933655d95266ce772b8a45b14aa27ec
---

 libavcodec/smacker.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 30dbaa7..0c1aa16 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -587,6 +587,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);



More information about the ffmpeg-cvslog mailing list