mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-13 10:51:38 +00:00
mtv: improve header check and avoid division by zero
CC: libav-stable@libav.org Bug-Id: CID 732203 / CID 732204
This commit is contained in:
parent
b3d11437ca
commit
f64d7e919e
@ -96,14 +96,17 @@ static int mtv_read_header(AVFormatContext *s)
|
|||||||
|
|
||||||
/* Calculate width and height if missing from header */
|
/* Calculate width and height if missing from header */
|
||||||
|
|
||||||
if(!mtv->img_width)
|
if (!mtv->img_width && mtv->img_height > 0 && mtv->img_bpp >= 8)
|
||||||
mtv->img_width=mtv->img_segment_size / (mtv->img_bpp>>3)
|
mtv->img_width=mtv->img_segment_size / (mtv->img_bpp>>3)
|
||||||
/ mtv->img_height;
|
/ mtv->img_height;
|
||||||
|
|
||||||
if(!mtv->img_height)
|
if (!mtv->img_height && mtv->img_width > 0 && mtv->img_bpp >= 8)
|
||||||
mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
|
mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
|
||||||
/ mtv->img_width;
|
/ mtv->img_width;
|
||||||
|
|
||||||
|
if (!mtv->img_width || !mtv->img_height)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
avio_skip(pb, 4);
|
avio_skip(pb, 4);
|
||||||
audio_subsegments = avio_rl16(pb);
|
audio_subsegments = avio_rl16(pb);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user