Unified · Split
| @@ -51,23 +51,28 @@ static int vqf_probe(const AVProbeData *probe_packet) · 50 unmodified lines | ||
| 51 | 51 | return AVPROBE_SCORE_EXTENSION; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | −static void add_metadata(AVFormatContext *s, uint32_t tag, | |
| 54 | +static int add_metadata(AVFormatContext *s, uint32_t tag, | |
| 55 | 55 | unsigned int tag_len, unsigned int remaining) |
| 56 | 56 | { |
| 57 | 57 | int len = FFMIN(tag_len, remaining); |
| 58 | 58 | char *buf, key[5] = {0}; |
| 59 | + int ret; | |
| 59 | 60 | |
| 60 | 61 | if (len == UINT_MAX) |
| 61 | − return; | |
| 62 | + return AVERROR_INVALIDDATA; | |
| 62 | 63 | |
| 63 | 64 | buf = av_malloc(len+1); |
| 64 | 65 | 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; | |
| 68 | 73 | buf[len] = 0; |
| 69 | 74 | 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); | |
| 71 | 76 | } |
| 72 | 77 | |
| 73 | 78 | static const AVMetadataConv vqf_metadata_conv[] = { |
| @@ -165,7 +170,9 @@ static int vqf_read_header(AVFormatContext *s) · 91 unmodified lines | ||
| 165 | 170 | avio_skip(s->pb, FFMIN(len, header_size)); |
| 166 | 171 | break; |
| 167 | 172 | 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; | |
| 169 | 176 | break; |
| 170 | 177 | } |
| 171 | 178 | |