diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-19 22:22:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-19 22:23:42 +0300 |
commit | 7a04c7f6d02a90388e722bf3a600327b52c744ac (patch) | |
tree | 43448f7f0172b8a8d4edc0b88b739cd3005da8a9 /intern/opennl | |
parent | 3b639b8b3d7742213559d028a23cfc664a13c013 (diff) |
Ensure no integer overflow happens in SuperLU solver on memory allocation
x
Diffstat (limited to 'intern/opennl')
-rw-r--r-- | intern/opennl/superlu/smemory.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/intern/opennl/superlu/smemory.c b/intern/opennl/superlu/smemory.c index a76f60a1758..c3b28a90e62 100644 --- a/intern/opennl/superlu/smemory.c +++ b/intern/opennl/superlu/smemory.c @@ -483,7 +483,7 @@ void else lword = sizeof(double); if ( Glu->MemModel == SYSTEM ) { - new_mem = (void *) SUPERLU_MALLOC(new_len * lword); + new_mem = (void *) SUPERLU_MALLOC((size_t)new_len * (size_t)lword); /* new_mem = (void *) calloc(new_len, lword); */ if ( no_expand != 0 ) { tries = 0; @@ -494,7 +494,7 @@ void if ( ++tries > 10 ) return (NULL); alpha = Reduce(alpha); new_len = alpha * *prev_len; - new_mem = (void *) SUPERLU_MALLOC(new_len * lword); + new_mem = (void *) SUPERLU_MALLOC((size_t)new_len * (size_t)lword); /* new_mem = (void *) calloc(new_len, lword); */ } } @@ -509,7 +509,7 @@ void } else { /* MemModel == USER */ if ( no_expand == 0 ) { - new_mem = suser_malloc(new_len * lword, HEAD); + new_mem = suser_malloc((size_t)new_len * (size_t)lword, HEAD); if ( NotDoubleAlign(new_mem) && (type == LUSUP || type == UCOL) ) { old_mem = new_mem; |