Commit 53b76149 authored by François Cartegnie's avatar François Cartegnie 🤞

vlc_arrays: mitigate bsearch signed overflow

parent d97c8e07
......@@ -168,7 +168,7 @@ static inline void *realloc_down( void *ptr, size_t size )
int low = 0, high = count - 1; \
answer = -1; \
while( low <= high ) {\
int mid = (low + high ) / 2; /* Just don't care about 2^30 tables */ \
int mid = ((unsigned int)low + (unsigned int)high) >> 1;\
zetype mid_val = entries[mid] elem;\
if( mid_val < key ) \
low = mid + 1; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment