anm: prevent infinite loop
authorLaurent Aimar <fenrir@videolan.org>
Fri, 30 Sep 2011 23:42:32 +0000 (23:42 +0000)
committerJanne Grunau <janne-libav@jannau.net>
Mon, 10 Oct 2011 19:36:12 +0000 (21:36 +0200)
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
libavcodec/anm.c

index 94cac5e..59de984 100644 (file)
@@ -81,6 +81,8 @@ static inline int op(uint8_t **dst, const uint8_t *dst_end,
         int striplen = FFMIN(count, remaining);
         if (buf) {
             striplen = FFMIN(striplen, buf_end - *buf);
         int striplen = FFMIN(count, remaining);
         if (buf) {
             striplen = FFMIN(striplen, buf_end - *buf);
+            if (*buf >= buf_end)
+                goto exhausted;
             memcpy(*dst, *buf, striplen);
             *buf += striplen;
         } else if (pixel >= 0)
             memcpy(*dst, *buf, striplen);
             *buf += striplen;
         } else if (pixel >= 0)