diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-01 16:49:22 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-01 16:49:22 +0300 |
commit | d7c51aa3eb50fd173664b724c1d289f3faf989cd (patch) | |
tree | ea31f25bf99ffd8fad0be0cf70dfba515980fe64 /source/blender/makesrna/intern/makesrna.c | |
parent | 7040c89af052e4983e2d71b00ff11c1d0b9cd8cf (diff) |
Bugfix #25437
Crash in Bezier animation (inserting keys on control points in
curve object). The animation rna paths were not fixed after an
editmode session, which got fixed 2 weeks ago, but for all older
binaries the issue can still pop up.
The crash happened because the RNA array-itterator was not doing
a boundary check, even whilst the array size was passed on to the
itterator callbacks. With rna then writing far outside of valid
memory, very bad and unpredictable corruptions happen.
I've added a range check now, and a decent print to denote the
issue. An assert quit is useless, since a tab-tab on curve objects
will fix the channels nicely.
Example of warning print:
Array itterator out of range: Spline_bezier_points_lookup_int (index 30 range 2)
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index c8e7fafbf5b..15dbe489f4e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -971,7 +971,10 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property if(strcmp(nextfunc, "rna_iterator_array_next") == 0) { fprintf(f, " ArrayIterator *internal= iter.internal;\n"); - fprintf(f, " if(internal->skip) {\n"); + fprintf(f, " if(index < 0 || index >= internal->length) {\n"); + fprintf(f, " printf(\"Array itterator out of range: %%s (index %%d range %%d)\\n\", __func__, index, internal->length); \n"); + fprintf(f, " }\n"); + fprintf(f, " else if(internal->skip) {\n"); fprintf(f, " while(index-- > 0) {\n"); fprintf(f, " do {\n"); fprintf(f, " internal->ptr += internal->itemsize;\n"); @@ -2389,6 +2392,7 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const "#define RNA_RUNTIME\n\n"); fprintf(f, "#include <float.h>\n"); + fprintf(f, "#include <stdio.h>\n"); fprintf(f, "#include <limits.h>\n"); fprintf(f, "#include <string.h>\n\n"); fprintf(f, "#include <stddef.h>\n\n"); |