diff options
Diffstat (limited to 'multimedia/ffmpeg/patches/patch-SA51464')
-rw-r--r-- | multimedia/ffmpeg/patches/patch-SA51464 | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/multimedia/ffmpeg/patches/patch-SA51464 b/multimedia/ffmpeg/patches/patch-SA51464 new file mode 100644 index 00000000000..d5a0c39cf52 --- /dev/null +++ b/multimedia/ffmpeg/patches/patch-SA51464 @@ -0,0 +1,85 @@ +$NetBSD: patch-SA51464,v 1.1 2012/12/19 14:58:33 drochner Exp $ + +see https://trac.videolan.org/vlc/ticket/7860 + +--- libavformat/swfdec.c.orig 2012-12-03 21:17:35.000000000 +0000 ++++ libavformat/swfdec.c +@@ -153,6 +153,10 @@ static int swf_read_packet(AVFormatConte + tag = get_swf_tag(pb, &len); + if (tag < 0) + return tag; ++ if (len < 0) { ++ av_log(s, AV_LOG_ERROR, "invalid tag length: %d\n", len); ++ return AVERROR_INVALIDDATA; ++ } + if (tag == TAG_VIDEOSTREAM) { + int ch_id = avio_rl16(pb); + len -= 2; +@@ -208,7 +212,10 @@ static int swf_read_packet(AVFormatConte + st = s->streams[i]; + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) { + frame = avio_rl16(pb); +- if ((res = av_get_packet(pb, pkt, len-2)) < 0) ++ len -= 2; ++ if (len <= 0) ++ goto skip; ++ if ((res = av_get_packet(pb, pkt, len)) < 0) + return res; + pkt->pos = pos; + pkt->pts = frame; +@@ -220,17 +227,22 @@ static int swf_read_packet(AVFormatConte + for (i = 0; i < s->nb_streams; i++) { + st = s->streams[i]; + if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { +- if (st->codec->codec_id == AV_CODEC_ID_MP3) { +- avio_skip(pb, 4); +- if ((res = av_get_packet(pb, pkt, len-4)) < 0) +- return res; +- } else { // ADPCM, PCM +- if ((res = av_get_packet(pb, pkt, len)) < 0) +- return res; +- } +- pkt->pos = pos; +- pkt->stream_index = st->index; +- return pkt->size; ++ if (st->codec->codec_id == AV_CODEC_ID_MP3) { ++ avio_skip(pb, 4); ++ len -= 4; ++ if (len <= 0) ++ goto skip; ++ if ((res = av_get_packet(pb, pkt, len)) < 0) ++ return res; ++ } else { // ADPCM, PCM ++ if (len <= 0) ++ goto skip; ++ if ((res = av_get_packet(pb, pkt, len)) < 0) ++ return res; ++ } ++ pkt->pos = pos; ++ pkt->stream_index = st->index; ++ return pkt->size; + } + } + } else if (tag == TAG_JPEG2) { +@@ -250,7 +262,10 @@ static int swf_read_packet(AVFormatConte + st = vst; + } + avio_rl16(pb); /* BITMAP_ID */ +- if ((res = av_new_packet(pkt, len-2)) < 0) ++ len -= 2; ++ if (len < 4) ++ goto skip; ++ if ((res = av_new_packet(pkt, len)) < 0) + return res; + avio_read(pb, pkt->data, 4); + if (AV_RB32(pkt->data) == 0xffd8ffd9 || +@@ -267,6 +282,9 @@ static int swf_read_packet(AVFormatConte + return pkt->size; + } + skip: ++ if(len<0) ++ av_log(s, AV_LOG_WARNING, "Cliping len %d\n", len); ++ len = FFMAX(0, len); + avio_skip(pb, len); + } + } |