avsdemux: check for out of bound writes
authorLaurent Aimar <fenrir@videolan.org>
Fri, 30 Sep 2011 23:42:31 +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>
libavformat/avs.c

index 1c699fb..cc0e849 100644 (file)
@@ -169,6 +169,8 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
 
             switch (type) {
             case AVS_PALETTE:
+                if (size - 4 > sizeof(palette))
+                    return AVERROR_INVALIDDATA;
                 ret = avio_read(s->pb, palette, size - 4);
                 if (ret < size - 4)
                     return AVERROR(EIO);