Skip to content

Commit 8145ecd

Browse files
authored
Avoid out-of-bounds reads from blas_quick_divide_table on big systems
1 parent 26ce518 commit 8145ecd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

common_x86.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
179179
return result;
180180
#else
181181

182+
if ( y > 64) {
183+
result = x/y;
184+
return result;
185+
}
182186
y = blas_quick_divide_table[y];
183187

184188
__asm__ __volatile__ ("mull %0" :"=d" (result) :"a"(x), "0" (y));

0 commit comments

Comments
 (0)