Commit b6d998df authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Avoid potential integer overflow when computing AR when transcoding.

It was introduced by [99e262c4].
(cherry picked from commit 0c0c1a06aedab0ddd73c7a9bf5290527deb07da0)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7c976039
......@@ -493,20 +493,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