diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-03 04:29:37 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-03 04:29:37 +0200 |
commit | e2b6cd7cc5f432672417241172b5df912a3fc325 (patch) | |
tree | 39ea66acae4faf7d22a8cefa109be7aba04acaaf /src | |
parent | d996ed88180dedf0d986ae4d8e1aedcd0cc6d902 (diff) | |
download | xine-lib-e2b6cd7cc5f432672417241172b5df912a3fc325.tar.gz xine-lib-e2b6cd7cc5f432672417241172b5df912a3fc325.tar.bz2 |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-utils/monitor.c | 6 |
1 files changed, 2 insertions, 4 deletions
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]; |