提交 638ef5f7 编写于 作者: A Andreas Rheinhardt

avformat/smacker: Don't read only one byte at a time

Instead use ffio_read_size to read data into a buffer. Also check that
the desired size was actually successfully read and combine the check
with the check for reading the extradata.
Signed-off-by: NAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
上级 09a39042
...@@ -215,15 +215,12 @@ static int smacker_read_header(AVFormatContext *s) ...@@ -215,15 +215,12 @@ static int smacker_read_header(AVFormatContext *s)
for (i = 0; i < smk->frames; i++) { for (i = 0; i < smk->frames; i++) {
smk->frm_size[i] = avio_rl32(pb); smk->frm_size[i] = avio_rl32(pb);
} }
for (i = 0; i < smk->frames; i++) { if ((ret = ffio_read_size(pb, smk->frm_flags, smk->frames)) < 0 ||
smk->frm_flags[i] = avio_r8(pb); /* load trees to extradata, they will be unpacked by decoder */
} (ret = ffio_read_size(pb, par->extradata + 16,
par->extradata_size - 16)) < 0) {
/* load trees to extradata, they will be unpacked by decoder */
ret = avio_read(pb, par->extradata + 16, par->extradata_size - 16);
if (ret != par->extradata_size - 16) {
av_freep(&smk->frm_size); av_freep(&smk->frm_size);
return AVERROR(EIO); return ret;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册