Commit c149f67e authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/apetag: More completely check avio_get_str() return value

This is not needed but its more proper to check the return value

Fixes CID1041122
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7ad742b2
...@@ -62,15 +62,19 @@ static int ape_tag_read_field(AVFormatContext *s) ...@@ -62,15 +62,19 @@ static int ape_tag_read_field(AVFormatContext *s)
if (flags & APE_TAG_FLAG_IS_BINARY) { if (flags & APE_TAG_FLAG_IS_BINARY) {
uint8_t filename[1024]; uint8_t filename[1024];
enum AVCodecID id; enum AVCodecID id;
int ret;
AVStream *st = avformat_new_stream(s, NULL); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
size -= avio_get_str(pb, size, filename, sizeof(filename)); ret = avio_get_str(pb, size, filename, sizeof(filename));
if (size <= 0) { if (ret < 0)
return ret;
if (size <= ret) {
av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key); av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key);
return 0; return 0;
} }
size -= ret;
av_dict_set(&st->metadata, key, filename, 0); av_dict_set(&st->metadata, key, filename, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment