Commit 0c0c1a06 authored by Laurent Aimar's avatar Laurent Aimar

Avoid potential integer overflow when computing AR when transcoding.

It was introduced by [45ee0e5c].
parent d650147f
......@@ -474,20 +474,20 @@ static void transcode_video_encoder_init( sout_stream_t *p_stream,
if( id->p_encoder->fmt_out.video.i_sar_num <= 0 ||
id->p_encoder->fmt_out.video.i_sar_den <= 0 )
{
vlc_ureduce( &id->p_decoder->fmt_out.video.i_sar_num,
&id->p_decoder->fmt_out.video.i_sar_den,
id->p_decoder->fmt_out.video.i_sar_num,
id->p_decoder->fmt_out.video.i_sar_den,
vlc_ureduce( &id->p_encoder->fmt_out.video.i_sar_num,
&id->p_encoder->fmt_out.video.i_sar_den,
(uint64_t)id->p_decoder->fmt_out.video.i_sar_num * i_src_width * i_dst_height,
(uint64_t)id->p_decoder->fmt_out.video.i_sar_den * i_src_height * i_dst_width,
0 );
}
else
{
vlc_ureduce( &id->p_encoder->fmt_out.video.i_sar_num,
&id->p_encoder->fmt_out.video.i_sar_den,
id->p_encoder->fmt_out.video.i_sar_num,
id->p_encoder->fmt_out.video.i_sar_den,
0 );
id->p_encoder->fmt_out.video.i_sar_num = id->p_decoder->fmt_out.video.i_sar_num * i_src_width * i_dst_height;
id->p_encoder->fmt_out.video.i_sar_den = id->p_decoder->fmt_out.video.i_sar_den * i_src_height * i_dst_width;
}
vlc_ureduce( &id->p_encoder->fmt_out.video.i_sar_num,
&id->p_encoder->fmt_out.video.i_sar_den,
id->p_encoder->fmt_out.video.i_sar_num,
id->p_encoder->fmt_out.video.i_sar_den,
0 );
id->p_encoder->fmt_in.video.i_sar_num =
id->p_encoder->fmt_out.video.i_sar_num;
......
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