History

avformat/vqf: Propagate errors from add_metadata()

Michael Niedermayer committed 1 year ago

Commit 49fa3f61 parent c43dbec1 file · +14 −7Browse files

Unified · Split

libavformat/vqf.c+14−7
@@ -51,23 +51,28 @@ static int vqf_probe(const AVProbeData *probe_packet) · 50 unmodified lines
5151 return AVPROBE_SCORE_EXTENSION;
5252 }
5353
54−static void add_metadata(AVFormatContext *s, uint32_t tag,
54+static int add_metadata(AVFormatContext *s, uint32_t tag,
5555 unsigned int tag_len, unsigned int remaining)
5656 {
5757 int len = FFMIN(tag_len, remaining);
5858 char *buf, key[5] = {0};
59+ int ret;
5960
6061 if (len == UINT_MAX)
61− return;
62+ return AVERROR_INVALIDDATA;
6263
6364 buf = av_malloc(len+1);
6465 if (!buf)
65− return;
66− if (len != avio_read(s->pb, buf, len))
67− return;
66+ return AVERROR(ENOMEM);
67+
68+ ret = avio_read(s->pb, buf, len);
69+ if (ret < 0)
70+ return ret;
71+ if (len != ret)
72+ return AVERROR_INVALIDDATA;
6873 buf[len] = 0;
6974 AV_WL32(key, tag);
70− av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
75+ return av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
7176 }
7277
7378 static const AVMetadataConv vqf_metadata_conv[] = {
@@ -165,7 +170,9 @@ static int vqf_read_header(AVFormatContext *s) · 91 unmodified lines
165170 avio_skip(s->pb, FFMIN(len, header_size));
166171 break;
167172 default:
168− add_metadata(s, chunk_tag, len, header_size);
173+ ret = add_metadata(s, chunk_tag, len, header_size);
174+ if (ret < 0)
175+ return ret;
169176 break;
170177 }
171178

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t