From: kramm <kramm>
Date: Wed, 12 Nov 2008 10:40:34 +0000 (+0000)
Subject: fixed memory corruption bug in id allocator
X-Git-Tag: release-0-9-0~825
X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=bd936b85021d03bc16b12e54414f68e79593a59b;p=swftools.git

fixed memory corruption bug in id allocator
---

diff --git a/src/swfc.c b/src/swfc.c
index c548b5c..0a1bf11 100644
--- a/src/swfc.c
+++ b/src/swfc.c
@@ -360,10 +360,11 @@ static void freeFontDictionary()
 
 static void incrementid()
 {
-    while(idmap[++id]) {
-	if(id==65535)
-	    syntaxerror("Out of character ids.");
+    while(id<65536 && idmap[id]) {
+        id++;
     }
+    if(id>=65536)
+	syntaxerror("Out of character ids.");
     idmap[id] = 1;
 }
 
@@ -4330,34 +4331,30 @@ static void parseArgumentsForCommand(char*command)
     if(nr<0)
 	syntaxerror("command %s not known", command);
 
+#ifndef EMPTY
     // catch missing .flash directives at the beginning of a file
     if(strcmp(command, "flash") && !stackpos)
     {
-	syntaxerror("No movie defined- use .flash first");
+        syntaxerror("No movie defined- use .flash first");
     }
+#endif
 
 #ifdef DEBUG
     printf(".%s\n", command);fflush(stdout);
     map_dump(&args, stdout, "\t");fflush(stdout);
 #endif
 
+#ifndef EMPTY
     (*arguments[nr].func)(&args);
-
-    /*if(!strcmp(command, "button") ||
-       !strcmp(command, "action")) {
-	while(1) {
-	    readToken();
-	    if(type == COMMAND) {
-		if(!strcmp(text, "end"))
-		    break;
-		else {
-		    pushBack();
-		    break;
-		}
-	    }
+#else
+    if(!strcmp(command, "action")  || !strcmp(command, "initaction") ||
+       !strcmp(command, "outline") || !strcmp(command, "gradient")) {
+	readToken();
+	if(type != RAWDATA) {
+	    syntaxerror("colon (:) expected");
 	}
-    }*/
-
+    }
+#endif
     map_clear(&args);
     return;
 }