Commit: 7a04c7f6d02a90388e722bf3a600327b52c744ac
Author: Sergey Sharybin
Date:   Sat Dec 20 00:22:33 2014 +0500
Branches: master
https://developer.blender.org/rB7a04c7f6d02a90388e722bf3a600327b52c744ac

Ensure no integer overflow happens in SuperLU solver on memory allocation
x

===================================================================

M       intern/opennl/superlu/smemory.c

===================================================================

diff --git a/intern/opennl/superlu/smemory.c b/intern/opennl/superlu/smemory.c
index a76f60a..c3b28a9 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to