mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-15 02:58:01 +00:00
avformat/icodec: Factor failure code out in read_header()
Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
f9eec62983
commit
27ee67c00f
@ -113,8 +113,7 @@ static int read_header(AVFormatContext *s)
|
|||||||
ico->images[i].size = avio_rl32(pb);
|
ico->images[i].size = avio_rl32(pb);
|
||||||
if (ico->images[i].size <= 0) {
|
if (ico->images[i].size <= 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "Invalid image size %d\n", ico->images[i].size);
|
av_log(s, AV_LOG_ERROR, "Invalid image size %d\n", ico->images[i].size);
|
||||||
av_freep(&ico->images);
|
goto fail;
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
}
|
||||||
ico->images[i].offset = avio_rl32(pb);
|
ico->images[i].offset = avio_rl32(pb);
|
||||||
|
|
||||||
@ -130,8 +129,7 @@ static int read_header(AVFormatContext *s)
|
|||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
if (ico->images[i].size < 40) {
|
if (ico->images[i].size < 40) {
|
||||||
av_freep(&ico->images);
|
goto fail;
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
}
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_BMP;
|
st->codecpar->codec_id = AV_CODEC_ID_BMP;
|
||||||
tmp = avio_rl32(pb);
|
tmp = avio_rl32(pb);
|
||||||
@ -143,12 +141,14 @@ static int read_header(AVFormatContext *s)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
avpriv_request_sample(s, "codec %d", codec);
|
avpriv_request_sample(s, "codec %d", codec);
|
||||||
av_freep(&ico->images);
|
goto fail;
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
fail:
|
||||||
|
av_freep(&ico->images);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
Loading…
Reference in New Issue
Block a user