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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-14 02:18:28 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-14 02:18:28 +0300
commitd0d47c70a924554667b35ceaea9e009f19980c69 (patch)
treef0151d14f4a54d955bccab9bbd149178a9af5d73 /source/blender/makesdna/intern/makesdna.c
parentce26d457baa36f34d84ccd64470d927f303286ff (diff)
Avoid a DNA parsing bug that would parse "float gravity [3];" as two
struct members "gravity" and "[3]". Now it throws an error in this case, safer than trying to fix the parsing code. Also patches the old DNA of ClothSimSettings which had this problem .. very ugly code. Fixes #20330: cloth sim settings getting corrupted when read from 2.49.
Diffstat (limited to 'source/blender/makesdna/intern/makesdna.c')
-rw-r--r--source/blender/makesdna/intern/makesdna.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 4ccabc95a32..2d62b81e81b 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -699,7 +699,7 @@ static int calculate_structlens(int firststruct)
for(b=0; b<structpoin[1]; b++, sp+=2) {
type= sp[0];
cp= names[sp[1]];
-
+
namelen= (int) strlen(cp);
/* is it a pointer or function pointer? */
if(cp[0]=='*' || cp[1]=='*') {
@@ -729,6 +729,10 @@ static int calculate_structlens(int firststruct)
len += sizeof(void *) * mul;
alphalen += 8 * mul;
+ } else if(cp[0]=='[') {
+ /* parsing can cause names "var" and "[3]" to be found for "float var [3]" ... */
+ printf("Parse error in struct, invalid member name: %s %s\n", types[structtype], cp);
+ dna_error = 1;
} else if( typelens[type] ) {
/* has the name an extra length? (array) */
mul= 1;