[vlc-commits] vlc_arrays: mitigate bsearch signed overflow
Francois Cartegnie
git at videolan.org
Wed Sep 14 18:46:52 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 14 18:16:12 2016 +0200| [53b76149dc42788a58aa160d4590af0e5cfa722d] | committer: Francois Cartegnie
vlc_arrays: mitigate bsearch signed overflow
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=53b76149dc42788a58aa160d4590af0e5cfa722d
---
include/vlc_arrays.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
index 886a7f9..ec3c85c 100644
--- a/include/vlc_arrays.h
+++ b/include/vlc_arrays.h
@@ -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; \
More information about the vlc-commits
mailing list