Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-22 05:25:22 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-07-04 20:19:34 +0300
commit638ef5f75896e60dc437d0955ced3cb1901a5e25 (patch)
tree64d00eac90804aae0152f2e2c28c9e1af7308706 /libavformat/smacker.c
parent09a39042db1b34672ba92a29c2b2f8f18a588a40 (diff)
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: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/smacker.c')
-rw-r--r--libavformat/smacker.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 2043563fdb..201372aee6 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -215,15 +215,12 @@ static int smacker_read_header(AVFormatContext *s)
for (i = 0; i < smk->frames; i++) {
smk->frm_size[i] = avio_rl32(pb);
}
- for (i = 0; i < smk->frames; i++) {
- smk->frm_flags[i] = avio_r8(pb);
- }
-
- /* 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) {
+ if ((ret = ffio_read_size(pb, smk->frm_flags, smk->frames)) < 0 ||
+ /* load trees to extradata, they will be unpacked by decoder */
+ (ret = ffio_read_size(pb, par->extradata + 16,
+ par->extradata_size - 16)) < 0) {
av_freep(&smk->frm_size);
- return AVERROR(EIO);
+ return ret;
}
return 0;