提交 2f687bc8 编写于 作者: A Andreas Rheinhardt

avformat/smacker: Check audio frame size

The first four bytes of smacker audio are supposed to contain the number
of samples, so treat audio frames smaller than that as invalid.
Signed-off-by: NAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
上级 02bbb370
......@@ -307,14 +307,14 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
if(flags & 1) {
uint32_t size;
size = avio_rl32(s->pb) - 4;
if (!size || size + 4LL > frame_size) {
size = avio_rl32(s->pb);
if ((int)size < 8 || size > frame_size) {
av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
ret = AVERROR_INVALIDDATA;
goto next_frame;
}
frame_size -= size;
frame_size -= 4;
size -= 4;
if ((ret = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) {
smk->buf_sizes[smk->curstream] = 0;
goto next_frame;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册