[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14991] branches/soc-2008-unclezeiv/source /blender/render/intern/source/lightcuts.c: Nasty crasher promptly reported by mfoxdogg (thanks): the cut nodes pool could be overflowed because reaching a leaf would confuse the counter .
Davide Vercelli
davide.vercelli at gmail.com
Tue May 27 03:30:23 CEST 2008
Revision: 14991
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14991
Author: unclezeiv
Date: 2008-05-27 03:30:17 +0200 (Tue, 27 May 2008)
Log Message:
-----------
Nasty crasher promptly reported by mfoxdogg (thanks): the cut nodes pool could be overflowed because reaching a leaf would confuse the counter.
(I'm leaving a debug print on purpose for now.)
While I am at it: the "lights" slider right now has no use, just set it to a value larger than the number of lights in your scene.
Modified Paths:
--------------
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
Modified: branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-05-27 00:03:37 UTC (rev 14990)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-05-27 01:30:17 UTC (rev 14991)
@@ -464,6 +464,8 @@
/* TODO: show that this size is always sufficient */
CutNode *cut_nodes;
int free_node= 1;
+ int it= 0;
+ int used= 0;
/* this heap maintaines the current cut */
/* TODO: its maximum size is known in advance, this allows to
@@ -500,12 +502,22 @@
}
/* at each iteration the heap grows by one, but we have a maximum size */
- while (BLI_heap_size(cut) < max_cut && BLI_heap_size(cut) > 0) {
- CutNode *node= BLI_heap_popmin(cut);
- LightcutsCluster *parent= &array_local[node->id];
+ while (BLI_heap_size(cut) < (max_cut - used) && BLI_heap_size(cut) > 0) {
+ CutNode *node;
+ LightcutsCluster *parent;
- if (parent->child1==0 && parent->child2==0)
+ node= BLI_heap_popmin(cut);
+ if (node < cut_nodes || node >= cut_nodes + (max_cut * 2 + 1)) {
+ printf("tricky node! at %d, %d (it=%d)\n", shi->xs, shi->ys, it);
+ break;
+ }
+ parent= &array_local[node->id];
+ it++;
+
+ if (parent->child1==0 && parent->child2==0) {
+ used++;
continue;
+ }
if (LC_LUMINOSITY(totest) * error_rate > node->error_bound * parent->intensity) {
break;
More information about the Bf-blender-cvs
mailing list