mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
avformat/tty: Check avio_size()
Fixes: CID1220824 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -123,7 +123,9 @@ static int read_header(AVFormatContext *avctx)
|
|||||||
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
|
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
|
||||||
|
|
||||||
if (avctx->pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
if (avctx->pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||||
s->fsize = avio_size(avctx->pb);
|
int64_t fsize = avio_size(avctx->pb);
|
||||||
|
if (fsize > 0) {
|
||||||
|
s->fsize = fsize;
|
||||||
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
|
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
|
||||||
|
|
||||||
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
|
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
|
||||||
@@ -131,6 +133,7 @@ static int read_header(AVFormatContext *avctx)
|
|||||||
|
|
||||||
avio_seek(avctx->pb, 0, SEEK_SET);
|
avio_seek(avctx->pb, 0, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user