[FFmpeg-cvslog] av_memcpy_backptr: avoid an infinite loop for back = 0
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Feb 24 13:52:58 CET 2013
On Sun, Feb 24, 2013 at 12:27:55PM +0100, Anton Khirnov wrote:
> ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Feb 13 21:36:25 2013 +0100| [f935aca44c674d30e3ed940ef73bbad1228a5855] | committer: Anton Khirnov
>
> av_memcpy_backptr: avoid an infinite loop for back = 0
>
> CC:libav-stable at libav.org
>
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f935aca44c674d30e3ed940ef73bbad1228a5855
> ---
>
> libavutil/mem.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libavutil/mem.c b/libavutil/mem.c
> index 3a4433d..391eb7d 100644
> --- a/libavutil/mem.c
> +++ b/libavutil/mem.c
> @@ -252,6 +252,9 @@ static void fill32(uint8_t *dst, int len)
> void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
> {
> const uint8_t *src = &dst[-back];
> + if (!back)
> + return;
This will leave dst uninitialized.
Either this is an expected case, then it should work
properly and use memset like the == 1 case (of course not
with *src but e.g. 0).
Or this is not expected then an assert would be more appropriate.
More information about the ffmpeg-cvslog
mailing list