Merge commit 'e70c5b034c4787377e82cab2d5565486baec0c2a'
* commit 'e70c5b034c4787377e82cab2d5565486baec0c2a': swfdec: do better validation of tag length Make LOCAL_ALIGNED syntactically similar on all systems Conflicts: libavformat/swfdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
be5389d585
@ -622,7 +622,9 @@ void ff_dsputil_init_dwt(DSPContext *c);
|
|||||||
uint8_t la_##v[sizeof(t s o) + (a)]; \
|
uint8_t la_##v[sizeof(t s o) + (a)]; \
|
||||||
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
|
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
|
||||||
|
|
||||||
#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
|
#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
|
||||||
|
DECLARE_ALIGNED(a, t, la_##v) s o; \
|
||||||
|
t (*v) o = la_##v
|
||||||
|
|
||||||
#define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
|
#define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (tag < 0)
|
if (tag < 0)
|
||||||
return tag;
|
return tag;
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "len %d is invalid\n", len);
|
av_log(s, AV_LOG_ERROR, "invalid tag length: %d\n", len);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
if (tag == TAG_VIDEOSTREAM) {
|
if (tag == TAG_VIDEOSTREAM) {
|
||||||
@ -258,7 +258,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
st = s->streams[i];
|
st = s->streams[i];
|
||||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
|
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
|
||||||
frame = avio_rl16(pb);
|
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;
|
return res;
|
||||||
pkt->pos = pos;
|
pkt->pos = pos;
|
||||||
pkt->pts = frame;
|
pkt->pts = frame;
|
||||||
@ -398,9 +401,14 @@ bitmap_end_skip:
|
|||||||
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
|
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
|
||||||
if (st->codec->codec_id == AV_CODEC_ID_MP3) {
|
if (st->codec->codec_id == AV_CODEC_ID_MP3) {
|
||||||
avio_skip(pb, 4);
|
avio_skip(pb, 4);
|
||||||
if ((res = av_get_packet(pb, pkt, len-4)) < 0)
|
len -= 4;
|
||||||
|
if (len <= 0)
|
||||||
|
goto skip;
|
||||||
|
if ((res = av_get_packet(pb, pkt, len)) < 0)
|
||||||
return res;
|
return res;
|
||||||
} else { // ADPCM, PCM
|
} else { // ADPCM, PCM
|
||||||
|
if (len <= 0)
|
||||||
|
goto skip;
|
||||||
if ((res = av_get_packet(pb, pkt, len)) < 0)
|
if ((res = av_get_packet(pb, pkt, len)) < 0)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -426,7 +434,10 @@ bitmap_end_skip:
|
|||||||
st = vst;
|
st = vst;
|
||||||
}
|
}
|
||||||
avio_rl16(pb); /* BITMAP_ID */
|
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;
|
return res;
|
||||||
avio_read(pb, pkt->data, 4);
|
avio_read(pb, pkt->data, 4);
|
||||||
if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
|
if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
|
||||||
@ -445,6 +456,7 @@ bitmap_end_skip:
|
|||||||
av_log(s, AV_LOG_DEBUG, "Unknown tag: %d\n", tag);
|
av_log(s, AV_LOG_DEBUG, "Unknown tag: %d\n", tag);
|
||||||
}
|
}
|
||||||
skip:
|
skip:
|
||||||
|
len = FFMAX(0, len);
|
||||||
avio_skip(pb, len);
|
avio_skip(pb, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user