Revision: 19739
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19739
Author:   sirdude
Date:     2009-04-15 18:16:00 +0200 (Wed, 15 Apr 2009)

Log Message:
-----------
Fixing more errors coverity found.

Imagepaint make sure ibuf exists before we use it.  This is CID# 545
editmesh_tools.c make sure were not indexing array with -1 This is CID# 137
        (also removed some trailing whitespace I found)

anim5.c totlen could be -1 so check its > -1  This is CID# 134

Kent

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/anim5.c
    trunk/blender/source/blender/src/editmesh_tools.c
    trunk/blender/source/blender/src/imagepaint.c

Modified: trunk/blender/source/blender/imbuf/intern/anim5.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/anim5.c   2009-04-15 15:40:31 UTC 
(rev 19738)
+++ trunk/blender/source/blender/imbuf/intern/anim5.c   2009-04-15 16:16:00 UTC 
(rev 19739)
@@ -425,7 +425,7 @@
        /* de hele file wordt in het geheugen gemapped */
 
        totlen = BLI_filesize(file);
-       if (totlen && file>=0) {
+       if (totlen>0 && file>=0) {
                lseek(file, 0L, SEEK_SET);
                
                mem= MEM_mallocN(totlen, "mmap");

Modified: trunk/blender/source/blender/src/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_tools.c   2009-04-15 15:40:31 UTC 
(rev 19738)
+++ trunk/blender/source/blender/src/editmesh_tools.c   2009-04-15 16:16:00 UTC 
(rev 19739)
@@ -2520,11 +2520,13 @@
                                                                }
                                                        }
                                                }
-                                               sort[hold]->f &= ~SELECT;
-                                               sort[hold]->f2 |= EDGENEW;
-                                               length[hold] = -1;
-                                       }                                       
                
-                               } 
+                                               if (hold > -1) {
+                                                       sort[hold]->f &= 
~SELECT;
+                                                       sort[hold]->f2 |= 
EDGENEW;
+                                                       length[hold] = -1;
+                                               }
+                                       }
+                               }
                                
                                // Beauty Long Edges
                                else {
@@ -2541,13 +2543,15 @@
                                                                }
                                                        }
                                                }
-                                               sort[hold]->f &= ~SELECT;
-                                               sort[hold]->f2 |= EDGENEW;
-                                               length[hold] = -1;
-                                       }                                       
                
-                               }   
+                                               if (hold > -1) {
+                                                       sort[hold]->f &= 
~SELECT;
+                                                       sort[hold]->f2 |= 
EDGENEW;
+                                                       length[hold] = -1;
+                                               }
+                                       }
+                               }
                        }
-               }       
+               }
        }
 
        gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); 

Modified: trunk/blender/source/blender/src/imagepaint.c
===================================================================
--- trunk/blender/source/blender/src/imagepaint.c       2009-04-15 15:40:31 UTC 
(rev 19738)
+++ trunk/blender/source/blender/src/imagepaint.c       2009-04-15 16:16:00 UTC 
(rev 19739)
@@ -708,9 +708,8 @@
        }
        
        ibuf = BKE_image_get_ibuf((Image *)tf->tpage, NULL); /* TODO - this may 
be slow, the only way around it is to have an ibuf index per face */
+       if (!ibuf) return 0;
        
-
-       
        if (interp) {
                float x, y;
                uvco_to_wrapped_pxco(uv, ibuf->x, ibuf->y, &x, &y);


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to