This is not needed but its more proper to check the return value
Fixes CID1041122
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -62,15 +62,19 @@ static int ape_tag_read_field(AVFormatContext *s) |
62 | 62 |
if (flags & APE_TAG_FLAG_IS_BINARY) { |
63 | 63 |
uint8_t filename[1024]; |
64 | 64 |
enum AVCodecID id; |
65 |
+ int ret; |
|
65 | 66 |
AVStream *st = avformat_new_stream(s, NULL); |
66 | 67 |
if (!st) |
67 | 68 |
return AVERROR(ENOMEM); |
68 | 69 |
|
69 |
- size -= avio_get_str(pb, size, filename, sizeof(filename)); |
|
70 |
- if (size <= 0) { |
|
70 |
+ ret = avio_get_str(pb, size, filename, sizeof(filename)); |
|
71 |
+ if (ret < 0) |
|
72 |
+ return ret; |
|
73 |
+ if (size <= ret) { |
|
71 | 74 |
av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key); |
72 | 75 |
return 0; |
73 | 76 |
} |
77 |
+ size -= ret; |
|
74 | 78 |
|
75 | 79 |
av_dict_set(&st->metadata, key, filename, 0); |
76 | 80 |
|