Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-11-07 17:50:04 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-11-07 17:50:42 +0300
commitf16199d479189f1f142aebecf896182a7276c483 (patch)
tree1c8370a36bd8b10abfecb1c84992c871ed5c498a /source/blender/blenlib/BLI_iterator.h
parent98ed20aafd60bd31e77b9da6e9b1157987c4fa56 (diff)
Fix jumps-dependent-on-uninitialized-variable for iterators
We cannot have iter->valid unitialized, but we need to be sure it is set to true on begin. Bug found by Sergey Sharybin.
Diffstat (limited to 'source/blender/blenlib/BLI_iterator.h')
-rw-r--r--source/blender/blenlib/BLI_iterator.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h
index dffdeec949a..d8929b6e73a 100644
--- a/source/blender/blenlib/BLI_iterator.h
+++ b/source/blender/blenlib/BLI_iterator.h
@@ -43,10 +43,12 @@ typedef void (*IteratorBeginCb)(BLI_Iterator *iter, void *data_in);
IteratorCb callback_end_func = callback_end; \
BLI_Iterator iter_macro; \
iter_macro.skip = false; \
+ iter_macro.valid = false; \
for (callback_begin(&iter_macro, (_data_in)); \
iter_macro.valid; \
callback_next(&iter_macro)) \
{ \
+ BLI_assert(iter_macro.valid); \
if (iter_macro.skip) { \
iter_macro.skip = false; \
continue; \