From a301bb63f05d0fa41e9dc9142b9a4e96ac5d5a64 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 26 Jan 2014 16:23:45 +0100 Subject: [PATCH] avcodec/huffyuvenc: fail if stats_out is too small instead of silently truncating Signed-off-by: Michael Niedermayer --- libavcodec/huffyuvenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index d01ca9c8f0..68f6903e35 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -947,6 +947,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } snprintf(p, end-p, "\n"); p++; + if (end <= p) + return AVERROR(ENOMEM); } } else avctx->stats_out[0] = '\0';