Browse Source

Avoid out of bounds reads from blas_quick_divide_table on big systems

Should fix #1541
tags/v0.3.0^2
Martin Kroeker GitHub 7 years ago
parent
commit
26ce518d46
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      common_x86_64.h

+ 3
- 1
common_x86_64.h View File

@@ -195,7 +195,9 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
unsigned int result; unsigned int result;


if (y <= 1) return x; if (y <= 1) return x;

if (y > 64) return x/y;
y = blas_quick_divide_table[y]; y = blas_quick_divide_table[y];


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


Loading…
Cancel
Save