From 8145ecd70bdfae44f62b5ff9a9e0ee427a2db3db Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 29 Apr 2018 14:38:55 +0200 Subject: [PATCH] Avoid out-of-bounds reads from blas_quick_divide_table on big systems --- common_x86.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common_x86.h b/common_x86.h index 4363fb2f4..de014064e 100644 --- a/common_x86.h +++ b/common_x86.h @@ -179,6 +179,10 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){ return result; #else + if ( y > 64) { + result = x/y; + return result; + } y = blas_quick_divide_table[y]; __asm__ __volatile__ ("mull %0" :"=d" (result) :"a"(x), "0" (y));