1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/wavarc: fix data end calculation

This commit is contained in:
Paul B Mahol 2023-09-02 16:17:00 +02:00
parent fc993e7a53
commit fb06a44360

View File

@ -70,8 +70,10 @@ static int wavarc_read_header(AVFormatContext *s)
if (avio_r8(pb)) if (avio_r8(pb))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
id = avio_rl32(pb); id = avio_rl32(pb);
w->data_end = avio_tell(pb);
if (avio_read(pb, data, sizeof(data)) != sizeof(data)) if (avio_read(pb, data, sizeof(data)) != sizeof(data))
return AVERROR(EIO); return AVERROR(EIO);
w->data_end += 16LL + AV_RL32(data + 4);
fmt_len = AV_RL32(data + 32); fmt_len = AV_RL32(data + 32);
if (fmt_len < 12) if (fmt_len < 12)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@ -98,8 +100,7 @@ static int wavarc_read_header(AVFormatContext *s)
if (id != MKTAG('d','a','t','a')) if (id != MKTAG('d','a','t','a'))
avio_skip(pb, avio_rl32(pb)); avio_skip(pb, avio_rl32(pb));
} while (id != MKTAG('d','a','t','a') && !avio_feof(pb)); } while (id != MKTAG('d','a','t','a') && !avio_feof(pb));
w->data_end = avio_rl32(pb); avio_skip(pb, 4);
w->data_end += avio_tell(pb);
if (AV_RL32(par->extradata + 16) != MKTAG('R','I','F','F')) if (AV_RL32(par->extradata + 16) != MKTAG('R','I','F','F'))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;