avsdemux: check for out of bound writes

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 6de33611c9)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Laurent Aimar 2011-09-30 23:42:31 +00:00 committed by Reinhard Tartler
parent ab201f6f1b
commit 7fa13e12e6
1 changed files with 2 additions and 0 deletions

View 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);