[vlc-devel] commit: Fixed undefined behavior with integer overflow. (Laurent Aimar )
git version control
git at videolan.org
Wed Jan 7 20:29:35 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jan 6 22:16:07 2009 +0100| [96dac2d9c21091973d242228bc016c52ee508478] | committer: Laurent Aimar
Fixed undefined behavior with integer overflow.
Pointed out by Courmish.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=96dac2d9c21091973d242228bc016c52ee508478
---
src/playlist/fetcher.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index 88a289c..d592389 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -28,6 +28,7 @@
#include <vlc_common.h>
#include <vlc_playlist.h>
#include <vlc_stream.h>
+#include <limits.h>
#include "art.h"
#include "fetcher.h"
@@ -269,7 +270,7 @@ static int DownloadArt( playlist_t *p_playlist, input_item_t *p_item )
{
int i_read = 65536;
- if( i_data + i_read <= i_data ) /* Protect gainst overflow */
+ if( i_data >= INT_MAX - i_read )
break;
p_data = realloc( p_data, i_data + i_read );
More information about the vlc-devel
mailing list