[MPlayer-cvslog] r37791 - trunk/stream/tvi_v4l2.c

reimar subversion at mplayerhq.hu
Sun Feb 21 19:26:06 CET 2016


Author: reimar
Date: Sun Feb 21 19:26:06 2016
New Revision: 37791

Log:
tvi_v4l2: Avoid potential integer overflows.

While it's unlikely for someone to request a buffer
size > 2GB there's not reason to not avoid an integer
overflow in that case.
Avoids a Coverity warning.

Modified:
   trunk/stream/tvi_v4l2.c

Modified: trunk/stream/tvi_v4l2.c
==============================================================================
--- trunk/stream/tvi_v4l2.c	Sun Feb 21 17:27:33 2016	(r37790)
+++ trunk/stream/tvi_v4l2.c	Sun Feb 21 19:26:06 2016	(r37791)
@@ -1412,13 +1412,13 @@ static int get_capture_buffer_size(priv_
     int cnt;
 
     if (priv->tv_param->buffer_size >= 0) {
-        bufsize = priv->tv_param->buffer_size*1024*1024;
+        bufsize = priv->tv_param->buffer_size*1024ull*1024;
     } else {
 #ifdef HAVE_SYS_SYSINFO_H
         struct sysinfo si;
 
         sysinfo(&si);
-        bufsize = (si.freeram/2)*si.mem_unit;
+        bufsize = (si.freeram/2ull)*si.mem_unit;
         if ( bufsize < 16*1024*1024)
 #endif
         bufsize = 16*1024*1024;


More information about the MPlayer-cvslog mailing list