[vlc-commits] dynamicoverlay: fix undefined signed overflow

Rémi Denis-Courmont git at videolan.org
Mon Feb 26 19:50:19 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb 26 20:42:40 2018 +0200| [74efed0d8217ee22966fe9d2c691b372cb89ab2d] | committer: Rémi Denis-Courmont

dynamicoverlay: fix undefined signed overflow

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74efed0d8217ee22966fe9d2c691b372cb89ab2d
---

 modules/spu/dynamicoverlay/dynamicoverlay_commands.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/spu/dynamicoverlay/dynamicoverlay_commands.c b/modules/spu/dynamicoverlay/dynamicoverlay_commands.c
index 63c1b2e5d6..2bd82921c0 100644
--- a/modules/spu/dynamicoverlay/dynamicoverlay_commands.c
+++ b/modules/spu/dynamicoverlay/dynamicoverlay_commands.c
@@ -31,6 +31,7 @@
 #include <vlc_vout.h>
 #include <vlc_filter.h>
 
+#include <limits.h>
 #include <string.h>
 #include <ctype.h>
 
@@ -92,11 +93,17 @@ static int skip_space( char **psz_command )
 static int parse_digit( char **psz_command, int32_t *value )
 {
     char *psz_temp;
-    *value = strtol( *psz_command, &psz_temp, 10 );
+    long l = strtol( *psz_command, &psz_temp, 10 );
+
     if( psz_temp == *psz_command )
     {
         return VLC_EGENERIC;
     }
+#if LONG_MAX > INT32_MAX
+    if( l > INT32_MAX || l < INT32_MIN )
+        return VLC_EGENERIC;
+#endif
+    *value = l;
     *psz_command = psz_temp;
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list