Commit: 0bd8d6d1949f29d283c6f00d4a316c4c9b2c8a5e
Author: Campbell Barton
Date:   Thu Jun 2 16:41:41 2016 +1000
Branches: master
https://developer.blender.org/rB0bd8d6d1949f29d283c6f00d4a316c4c9b2c8a5e

Add extra validation checks to array-store

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

M       source/blender/blenlib/intern/array_store.c

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

diff --git a/source/blender/blenlib/intern/array_store.c 
b/source/blender/blenlib/intern/array_store.c
index 7f657f4..b559061 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -1640,6 +1640,21 @@ bool BLI_array_store_is_valid(
                if (!(bchunk_list_size(chunk_list) == chunk_list->total_size)) {
                        return false;
                }
+
+               if (BLI_listbase_count(&chunk_list->chunk_refs) != 
chunk_list->chunk_refs_len) {
+                       return false;
+               }
+
+#ifdef USE_MERGE_CHUNKS
+               /* ensure we merge all chunks that could be merged */
+               if (chunk_list->total_size > bs->info.chunk_byte_size_min) {
+                       for (BChunkRef *cref = chunk_list->chunk_refs.first; 
cref; cref = cref->next) {
+                               if (cref->link->data_len < 
bs->info.chunk_byte_size_min) {
+                                       return false;
+                               }
+                       }
+               }
+#endif
        }
 
        {

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

Reply via email to