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';