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:
authorMiika Hamalainen <blender@miikah.org>2011-06-27 12:11:05 +0400
committerMiika Hamalainen <blender@miikah.org>2011-06-27 12:11:05 +0400
commitc896fcae7963fb35124ef3fefe0f12679228fa39 (patch)
treef4435bd39a36228a71c9142e4c26bacd482683f3 /source/blender/makesdna/intern
parentcb12648656fc001e8c4c6d00df73e52d452f8787 (diff)
parent93bb6238e0c6b7ea008776f4e1c3958ef5382c09 (diff)
Merge with trunk r37849
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r--source/blender/makesdna/intern/makesdna.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 0287990afc9..e40f2358794 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -671,6 +671,8 @@ int arraysize(char *astr, int len)
}
else if( str[a]==']' && cp) {
str[a]= 0;
+ /* if 'cp' is a preprocessor definition, it will evaluate to 0,
+ * the caller needs to check for this case and throw an error */
mul*= atoi(cp);
}
}
@@ -714,7 +716,12 @@ static int calculate_structlens(int firststruct)
/* has the name an extra length? (array) */
mul= 1;
if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
-
+
+ if (mul == 0) {
+ printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
+ dna_error = 1;
+ }
+
/* 4-8 aligned/ */
if(sizeof(void *) == 4) {
if (len % 4) {
@@ -744,7 +751,12 @@ static int calculate_structlens(int firststruct)
/* has the name an extra length? (array) */
mul= 1;
if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
-
+
+ if (mul == 0) {
+ printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
+ dna_error = 1;
+ }
+
/* struct alignment */
if(type >= firststruct) {
if(sizeof(void *)==8 && (len % 8) ) {