[vlc-devel] commit: Prevent setting volume to outrageous values. (Antoine Cellerier )
git version control
git at videolan.org
Mon Dec 21 23:25:29 CET 2009
vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Mon Dec 21 23:12:32 2009 +0100| [8cce51341d9b86a761f25a6f69b6e915f3183508] | committer: Antoine Cellerier
Prevent setting volume to outrageous values.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8cce51341d9b86a761f25a6f69b6e915f3183508
---
modules/misc/lua/libs/volume.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/misc/lua/libs/volume.c b/modules/misc/lua/libs/volume.c
index 23a0d5c..12a290f 100644
--- a/modules/misc/lua/libs/volume.c
+++ b/modules/misc/lua/libs/volume.c
@@ -53,8 +53,8 @@
static int vlclua_volume_set( lua_State *L )
{
playlist_t *p_this = vlclua_get_playlist_internal( L );
- int i_volume = luaL_checkint( L, 1 );
- /* Do we need to check that i_volume is in the AOUT_VOLUME_MIN->MAX range?*/
+ int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX),
+ AOUT_VOLUME_MIN);
int i_ret = aout_VolumeSet( p_this, i_volume );
vlclua_release_playlist_internal( p_this );
return vlclua_push_ret( L, i_ret );
More information about the vlc-devel
mailing list