Skip to content

Commit 26ce518

Browse files
authored
Avoid out of bounds reads from blas_quick_divide_table on big systems
Should fix #1541
1 parent 0ab5bf1 commit 26ce518

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common_x86_64.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
195195
unsigned int result;
196196

197197
if (y <= 1) return x;
198-
198+
199+
if (y > 64) return x/y;
200+
199201
y = blas_quick_divide_table[y];
200202

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

0 commit comments

Comments
 (0)