[vlc-commits] vout: fix overflow in subpicture sar
Francois Cartegnie
git at videolan.org
Sat Oct 21 20:56:35 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Oct 21 20:54:13 2017 +0200| [c2f5a6fce003fcfb0fda3fb0fcda28ec0d801e6a] | committer: Francois Cartegnie
vout: fix overflow in subpicture sar
triggers incorrect sar / subpicture size when
sar is set (scaling down)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c2f5a6fce003fcfb0fda3fb0fcda28ec0d801e6a
---
src/video_output/vout_subpictures.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 64a660ff34..50c358be04 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1085,10 +1085,14 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
/* Compute region scale AR */
video_format_t region_fmt = region->fmt;
if (region_fmt.i_sar_num <= 0 || region_fmt.i_sar_den <= 0) {
- region_fmt.i_sar_num = (int64_t)fmt_dst->i_visible_width * fmt_dst->i_sar_num * subpic->i_original_picture_height;
- region_fmt.i_sar_den = (int64_t)fmt_dst->i_visible_height * fmt_dst->i_sar_den * subpic->i_original_picture_width;
+
+ const uint64_t i_sar_num = (uint64_t)fmt_dst->i_visible_width *
+ fmt_dst->i_sar_num * subpic->i_original_picture_height;
+ const uint64_t i_sar_den = (uint64_t)fmt_dst->i_visible_height *
+ fmt_dst->i_sar_den * subpic->i_original_picture_width;
+
vlc_ureduce(®ion_fmt.i_sar_num, ®ion_fmt.i_sar_den,
- region_fmt.i_sar_num, region_fmt.i_sar_den, 65536);
+ i_sar_num, i_sar_den, 65536);
}
/* Compute scaling from original size to destination size
More information about the vlc-commits
mailing list