From f935aca44c674d30e3ed940ef73bbad1228a5855 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 13 Feb 2013 21:36:25 +0100 Subject: [PATCH] av_memcpy_backptr: avoid an infinite loop for back = 0 CC:libav-stable@libav.org --- libavutil/mem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/mem.c b/libavutil/mem.c index 3a4433d154..391eb7db38 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; + if (back == 1) { memset(dst, *src, cnt); } else if (back == 2) {