avidec: Make sure a packet is large enough before reading its data

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8d07258bb6)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/avidec.c
This commit is contained in:
Martin Storsjö
2013-09-28 00:41:31 +03:00
committed by Luca Barbato
parent 60701469ab
commit 2e4c649b3e

View File

@@ -752,8 +752,10 @@ static int avi_read_header(AVFormatContext *s)
return 0; return 0;
} }
static int read_gab2_sub(AVStream *st, AVPacket *pkt) { static int read_gab2_sub(AVStream *st, AVPacket *pkt)
if (!strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data+5) == 2) { {
if (pkt->size >= 7 &&
!strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data + 5) == 2) {
uint8_t desc[256]; uint8_t desc[256];
int score = AVPROBE_SCORE_MAX / 2, ret; int score = AVPROBE_SCORE_MAX / 2, ret;
AVIStream *ast = st->priv_data; AVIStream *ast = st->priv_data;