You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavc/h264_mp4toannexb: improve feedback in case of invalid bitstream
This commit is contained in:
@@ -81,9 +81,15 @@ static int h264_extradata_to_annexb(AVCodecContext *avctx, const int padding)
|
|||||||
|
|
||||||
unit_size = AV_RB16(extradata);
|
unit_size = AV_RB16(extradata);
|
||||||
total_size += unit_size + 4;
|
total_size += unit_size + 4;
|
||||||
if (total_size > INT_MAX - padding ||
|
if (total_size > INT_MAX - padding) {
|
||||||
extradata + 2 + unit_size > avctx->extradata +
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
avctx->extradata_size) {
|
"Too big extradata size, corrupted stream or invalid MP4/AVCC bitstream\n");
|
||||||
|
av_free(out);
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
if (extradata + 2 + unit_size > avctx->extradata + avctx->extradata_size) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Packet header is not contained in global extradata, "
|
||||||
|
"corrupted stream or invalid MP4/AVCC bitstream\n");
|
||||||
av_free(out);
|
av_free(out);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user