From e2b6cd7cc5f432672417241172b5df912a3fc325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 3 Apr 2007 04:29:37 +0200 Subject: Don't go casting around, check if id is over MAX_ID or if it's less than zero. Should fix the crash at startup reported by Bastien Nocera. --- src/xine-utils/monitor.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c index 6d7cba367..803d4ecdd 100644 --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -74,8 +74,7 @@ __inline__ unsigned long long int rdtsc(void) #endif void xine_profiler_start_count (int id) { - - if ((unsigned)id >= MAX_ID) return; + if ( id >= MAX_ID || id < 0 ) return; #if defined(ARCH_X86) || defined(ARCH_X86_64) profiler_start[id] = rdtsc(); @@ -83,8 +82,7 @@ void xine_profiler_start_count (int id) { } void xine_profiler_stop_count (int id) { - - if ((unsigned)id >= MAX_ID) return; + if ( id >= MAX_ID || id < 0 ) return; #if defined(ARCH_X86) || defined(ARCH_X86_64) profiler_times[id] += rdtsc() - profiler_start[id]; -- cgit v1.2.3