[Bf-blender-cvs] [0bd8d6d] master: Add extra validation checks to array-store

Campbell Barton noreply at git.blender.org
Thu Jun 2 10:21:05 CEST 2016


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
 	}
 
 	{




More information about the Bf-blender-cvs mailing list