[vlc-commits] linsys_sdi: Simplify and fix potential FPE
Hugo Beauzée-Luyssen
git at videolan.org
Wed Nov 22 16:01:13 CET 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Nov 22 15:45:00 2017 +0100| [09abd918efcbe2f017636d742af04347cd993ae9] | committer: Hugo Beauzée-Luyssen
linsys_sdi: Simplify and fix potential FPE
CID #1048725
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09abd918efcbe2f017636d742af04347cd993ae9
---
modules/access/linsys/linsys_sdi.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index 67efda8b40..9e97ceb4e5 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -223,21 +223,13 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys->i_last_state_change = mdate();
/* SDI AR */
- char *psz_ar = var_InheritString( p_demux, "linsys-sdi-aspect-ratio" );
- if ( psz_ar != NULL )
- {
- psz_parser = strchr( psz_ar, ':' );
- if ( psz_parser )
- {
- *psz_parser++ = '\0';
- p_sys->i_forced_aspect = p_sys->i_aspect =
- strtol( psz_ar, NULL, 0 ) * VOUT_ASPECT_FACTOR
- / strtol( psz_parser, NULL, 0 );
- }
- else
- p_sys->i_forced_aspect = 0;
- free( psz_ar );
- }
+ unsigned int i_num, i_den;
+ if ( !var_InheritURational( p_demux, &i_num, &i_den,
+ "linsys-hdsdi-aspect-ratio" ) && i_den != 0 )
+ p_sys->i_forced_aspect = p_sys->i_aspect =
+ i_num * VOUT_ASPECT_FACTOR / i_den;
+ else
+ p_sys->i_forced_aspect = 0;
/* */
p_sys->i_id_video = var_InheritInteger( p_demux, "linsys-sdi-id-video" );
More information about the vlc-commits
mailing list