[FFmpeg-devel] [PATCH 2/3] wavpackenc: report too small buffer
Paul B Mahol
onemda at gmail.com
Tue Aug 19 14:49:09 CEST 2014
On 8/19/14, Christophe Gisquet <christophe.gisquet at gmail.com> wrote:
> bytestream2_* will not cause buffer overflow, but on the other hand,
> it should be checked whether overflows have been prevented.
> ---
> libavcodec/wavpackenc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
> index 5b8973c..46c69a3 100644
> --- a/libavcodec/wavpackenc.c
> +++ b/libavcodec/wavpackenc.c
> @@ -2813,6 +2813,11 @@ static int wavpack_encode_block(WavPackEncodeContext
> *s,
> block_size = bytestream2_tell_p(&pb);
> AV_WL32(out + 4, block_size - 8);
>
> + if (put_bits_left(&s->pb) <= 0) {
> + av_log(s->avctx, AV_LOG_ERROR, "Packet allocated too small\n");
> + return AVERROR_INVALIDDATA;
> + }
> +
> return block_size;
> }
>
> --
> 1.9.2.msysgit.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
ok
More information about the ffmpeg-devel
mailing list